- Home /
How to determine the axis specific speed (or velocity) of a kinematic object?
For rigidbodies it is very straight forward to use rigidbody.velocity.x for example to get the velocity along a specific axes. However how would you do this for kinematic objects? I can do the following to get the overall velocity of a kinematic object, but this is not axis specific:
speed = ((transform.position - previous).magnitude) / Time.deltaTime;
previous = transform.position;
I would like to be able to determine the velocity along the x, y, and z axes separately; and then based on the velocity use conditionals to trigger specific functionality.
What is a good way to do this?
Comment