LanguageEnglish
  • C#
  • JS

Script language

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

Rigidbody.isKinematic

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual
public var isKinematic: bool;
public bool isKinematic;

Description

Controls whether physics affects the rigidbody.

If isKinematic is enabled, Forces, collisions or joints will not affect the rigidbody anymore. The rigidbody will be under full control of animation or script control by changing transform.position. Kinematic bodies also affect the motion of other rigidbodies through collisions or joints. Eg. can connect a kinematic rigidbody to a normal rigidbody with a joint and the rigidbody will be constrained with the motion of the kinematic body. Kinematic rigidbodies are also particularly useful for making characters which are normally driven by an animation, but on certain events can be quickly turned into a ragdoll by setting isKinematic to false.

var rb: Rigidbody;

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

function EnableRagdoll() { // Let the rigidbody take control and detect collisions. rb.isKinematic = false; rb.detectCollisions = true; }

function DisableRagdoll() { // Let animation control the rigidbody and ignore collisions. rb.isKinematic = true; rb.detectCollisions = false; }
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public Rigidbody rb; void Start() { rb = GetComponent<Rigidbody>(); } void EnableRagdoll() { rb.isKinematic = false; rb.detectCollisions = true; } void DisableRagdoll() { rb.isKinematic = true; rb.detectCollisions = false; } }