Aquazi
(Aquazi)
February 19, 2016, 9:16pm
1
Long story short the speed of my character is tied on the direction he’s moving.
If he’s going straight forward his speed is 400.
If he’s going backwards his speed is 200.
And other values.
Problem is, the pawn is always in the middle of the screen facing forward, so the direction of the pawn changes if I change mouse position.
But as soon as he rotates his X and Y speeds change, since relative to the world he’s moving on a different axis.
This prevents me from correctly calculating X and Y speed (as I am moving constantly along a different set of X an d Y).
How do I fix this?
Dannington
(Dannington)
February 19, 2016, 10:48pm
2
You need to get the length of the vector I think. Between ticks get a location, find the length between it and the one from the previous tick (there’s a node for it) and multiply the result by the tick delta.
6ixpool
(6ixpool)
February 20, 2016, 1:43am
3
Have you tried the “get forward vector node”? Sounds like just the thing you need incase im missing something.
If youre looking for something incredibly specific though, youd have to trudge through vector math just like dannington says im afraid…
Aquazi
(Aquazi)
February 22, 2016, 10:02am
4
I solved the problem by inverse trasforming the pawn’s forward vector and get velocity.