how to CORRECTLY position and rotate a gameobject in unity

How to correctly position and rotate a gameobject taking into consideration the different methods available?

Can anyone diminish the confusion by giving an explanation of what each of the following functions does and in what context should it be used (best practices, etc.)?

- Transform.position/localPosition

“The position of the transform in
world space./Position of the transform
relative to the parent transform.”

- Transform.rotation/localRotation

“The rotation of the transform in
world space stored as a
Quaternion./The rotation of the
transform relative to the parent
transform’s rotation.”

“Unity stores rotations as Quaternions internally. To rotate an object, use Transform.Rotate. Use Transform.eulerAngles for setting the rotation as euler angles.”
-what does this mean? when do i use these 3 ways of rotating a gameobject?

- Transform.Rotate

“Applies a rotation of eulerAngles.z
degrees around the z axis,
eulerAngles.x degrees around the x
axis, and eulerAngles.y degrees around
the y axis (in that order).”-why would i use Transform.Rotate and not Transform.rotation/localRotation?

- Transform.Translate

“Moves the transform in the direction
and distance of translation.”-why would i use Transform.Translate and not Transform.position/localPosition?

- Transform.eulerAngles

“Only use this variable to read and set
the angles to absolute values. Don’t
increment them, as it will fail when
the angle exceeds 360 degrees.”

- Rigidbody.position

“Get and set the position of a Rigidbody using the physics engine.”

“Use this if you want to teleport a rigidbody from one position to another, with no intermediate positions being rendered.”

“The transform will be updated after
the next physics simulation step.”

- Rigidbody.rotation

“Get and set the rotation of a Rigidbody using the physics engine.”

“Use this if you want to teleport a rigidbody from one rotation to another, with no intermediate positions being rendered.”

“The transform will be updated after
the next physics simulation step.”

- Rigidbody.MovePosition

“Use this if you want to continuously move a rigidbody in each FixedUpdate, which takes interpolation into account.”

- Rigidbody.MoveRotation

“Use this if you want to continuously rotate a rigidbody in each FixedUpdate, which takes interpolation into account.”

- Rigidbody.AddForce

“Adds a force to the rigidbody.”-used when?

- Rigidbody.AddTorque

“Adds a torque to the rigidbody.”-used when?

The only big difference i know between these is that you want to use Rigidbody functions for physics game objects, that are not kinematic. other than that, they seem to achieve the same result.

Other comments about this subject are appreciated.

Links

I think that the documentation is quite clear about this :

  • Transform.position :

Places your object in a specific point in the world space (regardless of the position of its parent). Places the object instantly, regardless to its previous position => Absolute position in world space.

  • Transform.localPosition :

Places your object in a specific point considering the position of its parent (the position of the parent is the origin of the “sub-space” of your object. Places the object instantly, regardless to its previous position => Absolute position in parent space.

  • Transform.rotation:

Set the rotation of your object in a specific way (set by Quaternion) in the world space (regardless of the rotation of its parent). Set the rotation of the object instantly, regardless to its previous rotation => Absolute rotation in world space.

  • Transform.localRotation :

Set the rotation of your object in a specific way (set by Quaternion) considering the rotation of its parent (the rotation of the parent is (0, 0, 0, 0) for you object) => Absolute rotation in parent space. Set the rotation of the object instantly, regardless to its previous rotation.

  • Transform.eulerAngles

Same as Transform.rotation but with euler angles (pitch, yaw, roll) to be easier to manipulate for humans.

  • Transform.Translate

Makes your object move considering its previous position (relative) and in its own space (unless you specify the relativeTo argument to Space.World). Use it if you do not know the position of if the final position doesn’t matter => Relative position in self / world space.

  • Transform.Rotate

Makes your object turn considering its previous rotation (relative) and in its own space (unless you specify the relativeTo argument to Space.World). Use it if you do not know the rotation of your object or if the final rotation doesn’t matter (you just want you object to turn) => Relative position in self / world space.

Rigidbody functions are based on physics, adding force to an object will “propel” your object in a direction for instance. As if you shoot in a soccer ball with your foot. You don’t have to calculate the position of your ball each FixedUpdate, the physics engine will do it for you.

in my case transform .position works as transform .local position it depends on previous position of object how do i resolve it? @Hellium