Hey, Im using javascript or unityscript (whatever) and heres my code which, according to the documentation should stop movement of the rigidbody on the Z axis;
Now, when I put this into my script to didn't work, at all, those names (constraints, etc...) are recognised by the editor or something, have the names changed or something?
I’m also not able to get this bit of code to work and can’t seem to find any answers online. When I run the script, I get a NullReferenceException, and even though I added a conditional testing for a NRE:
if(rigidbody != null){
rigidbody.constraints = RigidbodyConstraints.FreezeNone;
} else {
Debug.Log("rigidbody is null for some mysterious reason");
}
I don’t get my Debug message at all–just the same NRE.
To clear things up a bit RigidbodyConstraints is an enumeration while constraints derived from Rigidbody is a variable. The constraints variable can take several layered values from the enumeration RigidbodyConstraints.
Doing this should freeze all motion on the Z-axis: