1、为了获取和更改物体的运动状态,Unity3D预留了多个变量接⼝。
(1)角速度(angularVelocity)
GetComponent<Rigidbody>().angularVelocity = Vector3.up;
(2)位移速度(velocity):GetComponent<Rigidbody>().velocity = Vector3.up;
(3)重心(centerOfMass);(4)碰撞检测开关(detectCollisions):表示物体是否能够与其他物体碰撞,默认为true;
GetComponent<Rigibdoy>().detectCollisions = false;