Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Harvid on May 02, 2015, 07:45:12 PM
-
Hey
Is it possible to Get Speed for non-rigid bodies, similar to GetGameObjectSpeed.cs:
just in the local "self" derection.
I want to measure the speed of a object in the look at direction z
And if there is some another way of doing that please let me know :)
Isak
-
you coudl make a state machine that stores the current position, waits a certain amount of time...FINISH transition to the next state.
Next state you store current position#2, distance from last position, store distance as a float, after a certain amount of time, switch back to the first state....which would store the distance again.
This would just loop. over and over. You would then get a distance per time.
kind of a hack way of doing it...kinda weird how an object NEEDS a rigidbody to do the simple math.
-
Sorry i don't understand, won't it just given me the world position/speed, and not the local speed in one axies
-
you would be measuring the DISTANCE from vector3 to vector3.
This gives you the Distance per time.
-
pic attached
-
if you just want one axes you need to change the math around a little bit. But it would be the same concept.
-
Thanks for the idea but i can't get the vector 3d operator to give me any distance value :-\
screenshot in debug mode
-
distance will only get you a float value.
what you can do is store the position of the z axis ...store it as a Vector3
so Pos1 = 0,0,Z Pos2 = 0,0,Z
than you get the distance between the two vector3 variables. This would get the speed in the Z axis.
Although this would not be the local Z...it would be world.
-
Annoying am not aloud to store the distance in a vector3, like distance from XtoX YtoY ZtoZ...
I really need the local speed in the Z axis. Any other ideas ;)
-
make an empty child object and play around with the 'transform direction' and 'inverse transform direction' actions.
I think these actions should get what you are looking for.
-
inverse transform direction ? how i understand it is it only possible to transform local to world, i think i need the opposite somehow
-
Update of the script GetGameObjectSpeed.cs so it's contains a option for "self" local axis.