Answers for "remove force unity"

C#
1

remove force unity

using UnityEngine;

public class MyObject : MonoBehaviour
{
	private RigidBody m_rb;
    
    void Start()
    {
    	m_rb = GetComponent<RigidBody>();
    }
    
    // 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;
        }
    }
}
Posted by: Guest on April-29-2021

C# Answers by Framework

Browse Popular Code Answers by Language