Announcement

Collapse
No announcement yet.

How to acheive negative speed

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

    How to acheive negative speed

    Hi, I have made a 1D blendspace with speed variable with a range of -100 to 100, where 0 is for idle mode and 100 for forward movement and -100 for backward movement. In the anim preview editor in when I put negative value for speed it shows the backward movement animation correctly. But the problem is when I start to play it shows the forward movement animation for both the forward and backward movement, means there is no negative speed for forward or backward input. So,how can I achieve negative speed or use my backward movement animation??? Any help?

    #2
    If I understood correctly your character already move forward and backward correctly, you just want that active a specific animation when moving backward right?

    In this case this should be easy. Just change your animation depending speed value (if you can change it, you can get a reference for it).

    Where to add it, I guess, should be just after where you change the Speed value.

    Just do a check. If it is 1 or more, forward animation. If it is -1 or less, backward animation. And, if you want, if it is =0 idle animation.

    Comment


      #3
      Originally posted by vegetamaker View Post
      If I understood correctly your character already move forward and backward correctly, you just want that active a specific animation when moving backward right?

      In this case this should be easy. Just change your animation depending speed value (if you can change it, you can get a reference for it).

      Where to add it, I guess, should be just after where you change the Speed value.

      Just do a check. If it is 1 or more, forward animation. If it is -1 or less, backward animation. And, if you want, if it is =0 idle animation.
      Hi, yes I made the blendspace depending on speed value, it works in persona editor when I put a negative value in the speed variable. But it don't play in the game when I move backward. May be I need something to define speed variable which will tell it forward is positive and backward is negative speed in event graph of the anim blueprint. But I can't figure it out.

      Comment


        #4
        multiply the speed by 1 for forward anim, multiply the speed by -1 for backwards anim

        Comment


          #5
          If you're using the default system like in 3rd person template, your anim blueprint will be using something like "TryGetPawnOwner > Get Velocity > VectorLength > Set Speed". Which means it will just take an absolute value of your speed, meaning it will always be positive. You can however do something like this for getting whether or not your actor is moving toward where it's facing or not:

          Click image for larger version

Name:	6438613d05657c0ac165210b1da054dd.png
Views:	1
Size:	127.1 KB
ID:	1083361

          And then you can use that Z value to determine whether your speed should be multiplied with -1 or not.

          Comment


            #6
            Thank you guys. It really helped a lot.

            Comment

            Working...
            X