Description
The GetVelocityAtPoint
method of the Rigidbody
class returns the world space velocity of a specific point on the object. This is particularly useful for objects that are rotating around their own axis or origin, as it allows you to determine the velocity at any given point on the object's surface.
Usage
To use the GetVelocityAtPoint
method, you need to pass a reference to a Vector3
that represents the position of the point on the object for which you want to calculate the velocity. The method will return a Vector3
representing the velocity at that point in world space.
Example
// Example usage of GetVelocityAtPoint
Rigidbody rigidbody = new Rigidbody();
Vector3 point = new Vector3(1.0f, 0.0f, 0.0f);
Vector3 velocityAtPoint = rigidbody.GetVelocityAtPoint(ref point);
// velocityAtPoint now contains the velocity of the point in world space.