This is total n00b stuff… I’m sure it’s been discussed, but I haven’t found it yet… Sorry.
Trying to establish ‘front’ from ‘back’ of a rigid body–in order to know if it is traveling forward or backward
of course the most obvious action for me was–
rigidbody.velocity.x
but that is global, not local–is there an easy way to get local velocity relative to the object?
second try…
var angle = Vector3.Angle(transform.rotation, rigidbody.velocity);
but of course, rotation is in quaternion form, and I haven’t figured out how to generate a vector from rotation yet. I need a ‘I am pointed this way’ vector. Then compare to see if the angle is greater or less than 90 degrees to the direction of motion.
Obviously the faster the calculation the better, so local velocity is probably out unless I just need to call it…