Rigidbody.angularVelocity 角速度

var angularVelocity : Vector3

Description描述

The angular velocity vector of the rigidbody.

刚体的角速度向量。

In most cases you should not modify it directly, as this can result in unrealistic behaviour.

在大多数情况下,你不应该直接修改它,因为这会导致不真实的行为。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public Material fastWheelMaterial;
	public Material slowWheelMaterial;
	void Update() {
	if (rigidbody.angularVelocity.magnitude < 5)
		renderer.sharedMaterial = slowWheelMaterial;
	else
		renderer.sharedMaterial = fastWheelMaterial;
	}
}
// Change the material depending on the speed of rotation
//根据不同的旋转速度,改变这个材质

var fastWheelMaterial : Material;
var slowWheelMaterial : Material;
function Update () {
	if (rigidbody.angularVelocity.magnitude < 5) {
		renderer.sharedMaterial = slowWheelMaterial;
	}
	else {
		renderer.sharedMaterial = fastWheelMaterial;
	}
}
Page last updated: 2011-1-29