-
Notifications
You must be signed in to change notification settings - Fork 0
Rigidbody2D Extensions
Andrzej Kebab edited this page Feb 2, 2024
·
5 revisions
Clears the momentum of the Rigidbody2D instance.
rigidbody.ClearMomentum();Sets the x position of the Rigidbody2D instance.
rigidbody.SetPositionX(2.0f);Parameters:
-
{float} x: The x position.
Sets the y position of the Rigidbody2D instance.
rigidbody.SetPositionY(3.0f);Parameters:
-
{float} y: The y position.
Gets the x position of the Rigidbody2D instance.
float xPos = rigidbody.GetPositionX();Returns:
-
{float}: The x position.
Gets the y position of the Rigidbody2D instance.
float yPos = rigidbody.GetPositionY();Parameters:
-
{Rigidbody2D} rigidbody: The Rigidbody2D instance.
Returns:
-
{float}: The y position.
Sets the x velocity of the Rigidbody2D instance.
rigidbody.SetVelocityX(5.0f);Parameters:
-
{float} x: The x velocity.
Sets the y velocity of the Rigidbody2D instance.
rigidbody.SetVelocityY(-2.0f);Parameters:
-
{float} y: The y velocity.
Gets the x velocity of the Rigidbody2D instance.
float xVel = rigidbody.GetVelocityX();Returns:
-
{float}: The x velocity.
Gets the y velocity of the Rigidbody2D instance.
float yVel = rigidbody.GetVelocityY();Parameters:
-
{Rigidbody2D} rigidbody: The Rigidbody2D instance.
Returns:
-
{float}: The y velocity.
Adds to the x velocity of the Rigidbody2D instance.
rigidbody.AddVelocityX(2.0f);Parameters:
-
{float} x: The x velocity to add.
Adds to the y velocity of the Rigidbody2D instance.
rigidbody.AddVelocityY(-1.0f);Parameters:
-
{float} y: The y velocity to add.