Getting direction of characters movement based on velocity?

Hello,

I am trying to set up a system in VR that allows a player to climb, then launch/propel themselves off of the climbing rock. Through a roundabout way (taking the actor location and subtracting it from the location the previous tick), I have managed to get the velocity of the moving part of the character. However, I still need to get a direction that the player will be launched in from the velocity of the player. E.g. if the player throws themselves to the right, they are further propelled to the right, up to up, etc.

How would I go about getting a vector that is facing toward where the player is being propelled?

Thanks!

1 Like

if I understand what you are asking… I think this is fairly straightforward…

You are using a player Character actor… right? From the character movement component, draw out get velocity, then rotation from x vector… this will give you the direction as the world rotation of your characters velocity.

PS. if you’d like to get the magnitude of velocity (speed) of your character just draw out vector length

PPS. you can do a similar thing with a pawn or even an actor, it’s just that character has it’s own special velocity check built in so it might be more performance efficient

3 Likes

If I understand correctly, that would work on a character that is only rotating on 1 plane. Is there any way to get the vector in 2 dimensions? E.g. velocity moving left and up, or right and down.

Thanks.

Ok… so the above will give you the total velocity speed and rotation of the character in 3d… in world space.

You can also get the forward/backwards, up/down and left/right velocity speed… relative to the direction the character is facing… is this what you are looking for?

PS. props to @anonymous_user_07b2b30b for perhaps a more efficient/elegant solution than my original one…

7 Likes