Version: 2023.1
LanguageEnglish
  • C#

Rigidbody2D.MovePositionAndRotation

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual

Declaration

public void MovePositionAndRotation(Vector2 position, float angle);

Parameters

position The position to move the rigidbody to.
angle The angle to move the rigidbody to.

Description

Moves the rigidbody position to position and the rigidbody angle to angle.

This is a combination of calling both MovePosition and MoveRotation. This can be used to increase performance by not having to perform two separate calls to queue movements.

For more details on the operation of movement using these methods, see Rigidbody2D.MovePosition and Rigidbody2D.MoveRotation.


Declaration

public void MovePositionAndRotation(Vector2 position, Quaternion rotation);

Parameters

position The position to move the rigidbody to.
rotation The rotation to move the rigidbody to. Only the Z-Axis rotation is used from the full 3D Quaternion rotation.

Description

Moves the rigidbody position to position and the rigidbody angle to rotation.

This is a combination of calling both MovePosition and MoveRotation. This can be used to increase performance by not having to perform two separate calls to queue movements.

For more details on the operation of movement using these methods, see Rigidbody2D.MovePosition and Rigidbody2D.MoveRotation.