Script language:

  • JS
  • C#
  • Boo
Script language

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

Rigidbody.worldCenterOfMass

Switch to Manual
var worldCenterOfMass: Vector3;
Vector3 worldCenterOfMass;
worldCenterOfMass as Vector3

Description

The center of mass of the rigidbody in world space (Read Only).

	Debug.Log(rigidbody.worldCenterOfMass);
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    void Example() {
        Debug.Log(rigidbody.worldCenterOfMass);
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	def Example() as void:
		Debug.Log(rigidbody.worldCenterOfMass)