一,同时施加多个限制:
用按位或(bitwise OR)实现,例如:
GetComponent<Rigidbody>().constraints=RigidbodyConstraints.FreezeRotation
|RigidbodyConstraints.FreezePositionX
|RigidbodyConstraints.FreezePositionZ;
二,去掉所有限制:
GetComponent<Rigidbody>().constraints=RigidbodyConstraints.None;
时间: 2024-10-13 09:26:18