I'm looking to find out what the velocity of a rigidbody is on a specified local axis.
I'm building a simulation/shooter based on scifi airship warfare, which includes both planes and floating anti-gravity airships. For the planes, I'd like to get the speed along the z-axis for a simplified calculation of lift. In aerial geek-talk, I'm basically interested in Indicated Airspeed.
For the airships, it will be used to aid calculating collision damage, hopefully in conjunction with a normal-line between the colliding parts. The logic is that fast-front hitting damage will do more than a gentle glancing bump.
Can anyone suggest the most efficient way to do this? I'm really looking for the closest actual equivalent to "rigidbody.GetLocalVelocity(z);"
You could do what the Car tutorial does. To find the local velocity it goes:
or when you use OnCollisionEnter(col : Collision), consider using Collision.RelativeVelocity.
answered May 21 '10 at 01:33 AM
I'm confused. Why can't you just use
You could also write your own speed calculator, just save the x/y/z position from the previous Update and then subtract it from the current one, which gives you the speed. Something along the lines of:
answered May 20 '10 at 11:49 PM