I have created this simple test script to change a rigidboyds constrains during runtime.
[full script][1]
void Update () {
if (Input.GetKeyDown ("x")) {
if(!falling){
print ("going down");
gameObject.rigidbody.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY;
falling = true;
}else{
print ("stoping");
gameObject.rigidbody.constraints = RigidbodyConstraints.FreezePosition | RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY;
falling = false;
}
}
}
The problem is that the object ignores gravity and stays stationary, should I be doing something else ?
[1]: using UnityEngine;using System.Collections;public class test : MonoBehavio - Pastebin.com