Rigidbody.AddRelativeTorque 添加相对力矩

function AddRelativeTorque (torque : ForceMode = ForceMode.Force) : void

Description描述

Adds a torque to the rigidbody relative to the rigidbodie's own coordinate system.

添加一个力矩到刚体,相对于刚体自身的坐标系统。

As a result the rigidbody will start spinning around the torque axis.

作为结果刚体将绕着torque轴旋转。

using UnityEngine;

using System.Collections;



public class example : MonoBehaviour {

	void FixedUpdate() {

		rigidbody.AddRelativeTorque(Vector3.up * 10);

	}

}
// Spins the rigidbody around its own y-axis

//旋转刚体绕它自身的y轴



function FixedUpdate () {

	rigidbody.AddRelativeTorque (Vector3.up * 10);

}

o function AddRelativeTorque (x : float, y : float, z : float, mode : ForceMode = ForceMode.Force) : void

Description描述

Adds a torque to the rigidbody relative to the rigidbodie's own coordinate system.

添加一个力矩到刚体,相对于刚体自身的坐标系统。

As a result the rigidbody will start spinning around the torque axis.

作为结果刚体将绕着torque轴旋转。

using UnityEngine;

using System.Collections;



public class example : MonoBehaviour {

	void FixedUpdate() {

		rigidbody.AddRelativeTorque(0, 10, 0);

	}

}
// Spins the rigidbody around its own y-axis

//旋转刚体绕它自身的y轴



function FixedUpdate () {

	rigidbody.AddRelativeTorque (0, 10, 0);

}

If you want to apply a force over several frames you should apply it inside FixedUpdate instead of Update.

如果你想在多帧中应用力,你应该在FixedUpdate中而不是Update使用使用它。

Page last updated: 2011-2-9
Rigidbody.AddRelativeTorque 添加相对力矩_unity3d游戏脚本制作教程-游戏蛮牛出品

Rigidbody.AddRelativeTorque 添加相对力矩

function AddRelativeTorque (torque : ForceMode = ForceMode.Force) : void

Description描述

Adds a torque to the rigidbody relative to the rigidbodie's own coordinate system.

添加一个力矩到刚体,相对于刚体自身的坐标系统。

As a result the rigidbody will start spinning around the torque axis.

作为结果刚体将绕着torque轴旋转。

using UnityEngine;

using System.Collections;



public class example : MonoBehaviour {

	void FixedUpdate() {

		rigidbody.AddRelativeTorque(Vector3.up * 10);

	}

}
// Spins the rigidbody around its own y-axis

//旋转刚体绕它自身的y轴



function FixedUpdate () {

	rigidbody.AddRelativeTorque (Vector3.up * 10);

}

o function AddRelativeTorque (x : float, y : float, z : float, mode : ForceMode = ForceMode.Force) : void

Description描述

Adds a torque to the rigidbody relative to the rigidbodie's own coordinate system.

添加一个力矩到刚体,相对于刚体自身的坐标系统。

As a result the rigidbody will start spinning around the torque axis.

作为结果刚体将绕着torque轴旋转。

using UnityEngine;

using System.Collections;



public class example : MonoBehaviour {

	void FixedUpdate() {

		rigidbody.AddRelativeTorque(0, 10, 0);

	}

}
// Spins the rigidbody around its own y-axis

//旋转刚体绕它自身的y轴



function FixedUpdate () {

	rigidbody.AddRelativeTorque (0, 10, 0);

}

If you want to apply a force over several frames you should apply it inside FixedUpdate instead of Update.

如果你想在多帧中应用力,你应该在FixedUpdate中而不是Update使用使用它。

Page last updated: 2011-2-9