📜  移除强制统一 - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:15.199000             🧑  作者: Mango

代码示例1
using UnityEngine;

public class MyObject : MonoBehaviour
{
    private RigidBody m_rb;
    
    void Start()
    {
        m_rb = GetComponent();
    }
    
    // Do it in FixedUpdate() if it's triggered by physics (collision-based for
    // example), Update() otherwise.
    void FixedUpdate()
    {
        if(yourCondition)
        {
            m_rb.velocity = Vector3.zero;
        }
    }
}