Check out example codes for "freeze position unity c#". It will help you in understanding the concepts better.
Code Example 1
rigidbody.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ | RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezePositionZ;
Learn ReactJs, React Native from akashmittal.com