How do I freeze an objects position?

I need to be able to freeze an objects position, exactly like the constraints in rigidbody, but in code.

Rigidbody constraints are managed through scripts as mentioned below.

 rigidbody.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ;

A list of all the defined RigidbodyConstraints can be found here:

Another example, say you wanted the object to only move along the ‘X’ axis and rotate on the ‘Y’ axis. You would do:

 rigidbody.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ | RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezePositionZ;

If you want to freeze rotation and position completely use “Freeze All” command.

Hope it helps

but how do you freeze movement? Not rotation.