unity freeze transform position code example
Example 1: unity set position
// To set the position of a gameobject use the following
GameObject.transform.position = new Vector3(x, y, z);
Example 2: freeze position unity c#
rigidbody.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ | RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezePositionZ;
Example 3: how to chagne rotation in unity
transform.eulerAngles = new Vector3(0f, 180f, 0f); // rotates 180 degrees