function OnTriggerEnter(col : Collider)
{
if(col.tag =="Player")
{
SpawnPoint.position = Vector3(transform.position.x, transform.position.y, transform.position.z);
}
}
如何在产生检查点后停止对象的运行
答案 0 :(得分:1)
你应该做的是简单地将刚体设置为运动学,以及brakeTorque
将所有车轮碰撞器设置为Mathf.Infinity
,然后下一次更新将其关闭,物理引擎应重置任何导致的力它要移动。
链接示例:
function FixedUpdate()
{
// (if the vehicle has been respanwed this frame,
// then a variable respawned is set to true)
if (respawned)
{
wheelCol.brakeTorque = Mathf.Infinity; // Repeat for all wheelcolliders
rigidbody.isKinematic = true;
respawned = false;
}
else
{
rigidbody.isKinematic = false;
// (do the torque calculations here as usual)
}
}