Rigidbody.isKinematic 是否动力学

var isKinematic : bool

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 rigidbodiy 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.

如果isKinematic启用,力、碰撞或关节将不会影响这个刚体。刚体将通过改变transform.postion根据动画或脚本完全控制。动力学刚体也会通过碰撞或关节影响其他刚体的运动。例如,可以使用关节链接动力学刚体到一个普通的刚体,并且这个刚体将受到动力学刚体运动的约束。动力学刚体也被用于制作角色,它们通常是由动画驱动,但是在某些事件可以通过设置isKinematic为false,快速转化为一个布娃娃。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public void Awake() {
		rigidbody.isKinematic = true;
	}
}
// Don't let the rigidbody be affected by physics!
//不让刚体受到物理的影响

rigidbody.isKinematic = true;
最后修改:2011年1月29日 Saturday 16:35

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。