unity rigidbody disable collision code example
Example: disable rigidbody unity
//This is for Unity (c#)
Rigidbody rb; //For 2D games use 'Rigidbody2D'
void Awake ()
{
rb = GetComponent<Rigidbody>();
}
// (...)
rb.bodyType = RigidbodyType2D.Static; // Deactivated
rb.bodyType = RigidbodyType2D./*The type the rigidbody was originally eg. dynamic, kinematic, or static*/; // Activated