Announcement

Collapse
No announcement yet.

How to play animations for 3rd person weapons [SOLVED -- Stupid error like everytime]

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to play animations for 3rd person weapons [SOLVED -- Stupid error like everytime]

    hi!
    is it possible to play animations on the third person view of a weapon?

    i tryed something like this:
    PHP Code:
    //from my weaponfire class
    local gibblerAttachment att;
    att gibblerAttachment(Weapon.ThirdPersonActor);

    att.LitWeapon.PlayAnim('MixerExtend',,,1); 
    but i get an "Access None" warning on LitWeapon

    it would be important to see these animations on third person actors...

    #2
    If you want to play an animation on the thirdperson actor itself you would just do att.playanim('MixerExtend',,,1);

    What does LitWeapon reference to? It must be a variable in your attachment class but what is it for?

    Comment


      #3
      You don't need to do casting there since PlayAnim is declared in Actor.uc and so is available to all actors. So this should do it:
      Code:
      Weapon.ThirdPersonActor.PlayAnim('MixerExtend',,,1);

      Comment


        #4
        thirdpersonactor (in this case) refers to a xWeaponAttachment class, not the weapon itself. Since LitWeapon is the only reference from xWeaponAttachment to a weapon i thought that this is the rendered weapon.

        i tried
        Weapon.ThirdPersonActor.PlayAnim('MixerExtend',,,1 );
        and
        att.playanim('MixerExtend',,,1);

        but it just does nothing . Is there somewhere a bool that specifies if animations should be played?

        Comment


          #5
          Are you sure the animation exists and has been linked to the mesh? Check the log for animation errors.

          Comment


            #6
            I take it you have animations for the 3rd person model your using for the attachment class right? I know I had an issue initially because I thought that simply because the attachment model and the 1st person were in the same animation file, that they would share animations. Not true (unless you set them up to).

            So if Weapon.ThirdPersonActor.PlayAnim('MixerExtend',,,1 ); didn't work, are you sure that functions getting called when you think it is? Did you try throwing a log("playingAnim") in front of it or something?

            I used to always be like wtf when something wasnt happening, thinking it was problems with my code. Well it was, but the problem was that the code was never being called.

            So, is it being called for sure? Is that animation associated with the attachment model? try a different animation for testing?

            Comment


              #7
              i use the same mesh for 1st and 3rd view. (ATM... i'll do a lowpoly version later...)

              the function
              function BeginState()
              {
              weapon.ThirdPersonActor.PlayAnim('MixerExtend',,,1 );
              weapon.PlayAnim('MixerExtend',,,1);
              }

              is being called and the anims are linked correctly because i see the anims in 1st person view.

              btw, i just tested it with an instigator.clientmessage. and its called correctly in 3rd person view, too.


              edit: ahhh there comes a thought... i linked bones to channels on the firstperson view weapon. but not on the 3rd. personview one... :noob: i'll try to link them too... i'm such an idiot....

              Comment


                #8
                nope, that wasn't the problem... still no anim in 3rd person...

                Comment


                  #9
                  Hmm.

                  Well wait, are we sure that the Weapon.ThirdPersonActor actually refers to your attachment class?

                  Like the attachment is what should be playing the animation right?

                  So Weapon refers to the weapon class, and not the attachment class.

                  Is there a way to get that particular instance of the attachment? Im sure there is, but I think thats what you may have to look for rather than the instance of the weapon itself.

                  Does that sound reasonable?

                  Comment


                    #10
                    are we sure that the Weapon.ThirdPersonActor actually refers to your attachment class?
                    yes, we are. quote from ShieldAltFire.uc:
                    Code:
                        local ShieldAttachment Attachment;
                    
                        Attachment = ShieldAttachment(Weapon.ThirdPersonActor);
                       //...
                      
                        if( Attachment != None && Attachment.ShieldEffect3rd != None )
                            Attachment.ShieldEffect3rd.bHidden = false;
                    they cast the Weapon.ThirdPersonActor to theyr ShieldAttachment class.

                    btw:
                    the ThirdPersonActor is assigned in Inventory.uc:
                    Code:
                    ThirdPersonActor = Spawn(AttachmentClass,Owner);

                    Comment


                      #11
                      i've found my problem!

                      "I'm such an idiot", Part 2:

                      it was the problem which i wrote first, i played animations on channels that arent set... Then ok, i set the channels. In postBeginPlay. what i didn't know was that when postbeginplay is being executed, thirdPersonActor isn't set. So getting an "access none" on thirdPersonActor.
                      Now i set the animBlenParams everytime before i call play PlayAnim...

                      sometimes i do really stupid errors...

                      Comment


                        #12
                        Good deal, I will be after you when I want to do some animations. I havent done shizzit with them yet so...

                        Comment

                        Working...
                        X