Legacy Documentation: Version 5.1
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Rigidbody.GetPointVelocity

Switch to Manual
public function GetPointVelocity(worldPoint: Vector3): Vector3;

Parameters

Description

The velocity of the rigidbody at the point worldPoint in global space.

GetPointVelocity will take the angularVelocity of the rigidbody into account when calculating the velocity.

var rb: Rigidbody;

function Start() { rb = GetComponent.<Rigidbody>(); }

// Get the velocity of a wheel, specified by its // position in local space. function CalcWheelVelocity(localWheelPos: Vector3) { return rb.GetPointVelocity(transform.TransformPoint(localWheelPos)); }