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;
}
}
}