Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: tezer86 on May 07, 2014, 05:46:12 AM
-
Hey fellow playmakers,
So I'm onto my next problem
I need to work out the direction that an object is moving in so that I can use that to do a Look At action and use that variable.
My question is, how do I work out what direction the player is moving in? In my head the way is to take a Vector3 and then another after a set time later. Compare the two and then find out the exact opposite of that, and thats the direction you are moving in.
Im wondering if there is a cleaner way of doing this and if anyone can give me some tips on how to do it?
Thanks in advance
Terry
-
Hi,
that would be one way.
You can get the speed of your player, and the direction of the speed would indeed be the direction of your player.
use "Get speed" action.
if your player is not a rigidBody, I made a custom action to get the speed of noon rigid body.
http://hutonggames.com/playmakerforum/index.php?topic=1182.msg4961#msg4961
Bye,
Jean
-
Hey Jean,
Thanks for the quick reply, I will try thus when I get back tonight.
Cheers
Terry
-
Just looking at it now, How do I work out the direction of speed?
cheers
Terry
-
Ah ok I have it, I got velocity and then used that to 'Look at Direction’. Thanks a lot for your health.
-
Ah ok I have it, I got velocity and then used that to 'Look at Direction’. Thanks a lot for your health.
Mind sharing a screenshot of the working solution, just the action states.
really curious about this.
-
Ugh, I feel stupid for getting the old position, getting the current position, subtracting them to get the change per frame, and using that as a direction...
Then I moved to simply looking at the old position. (which always faced backwards)
I've been doing that on so many projects... :-[
I could have just used the current velocity! DOH! :o
EDIT: Here's some screenshots of 'looking at velocity'.
(http://i.imgur.com/3tKtRw1.gif)
(http://i.imgur.com/4S5JCqq.jpg)