Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

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

Rigidbody.GetPointVelocity

Switch to Manual
GetPointVelocity(worldPoint: Vector3): Vector3;
Vector3 GetPointVelocity(Vector3 worldPoint);
def GetPointVelocity(worldPoint as Vector3) as Vector3

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.

	// Prints the velocity of the wheel

var point : Vector3; var velocity : Vector3; point = transform.InverseTransformPoint(Vector3(0, -.2, 0)); velocity = rigidbody.GetPointVelocity(point); print(velocity.magnitude);

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    public Vector3 point;
    public Vector3 velocity;
    void Example() {
        point = transform.InverseTransformPoint(new Vector3(0, -0.2F, 0));
        velocity = rigidbody.GetPointVelocity(point);
        print(velocity.magnitude);
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	public point as Vector3

	public velocity as Vector3

	def Example() as void:
		point = transform.InverseTransformPoint(Vector3(0, -0.2F, 0))
		velocity = rigidbody.GetPointVelocity(point)
		print(velocity.magnitude)