Skip to content

Rigidbody2D Move Towards Target

Moves a Rigidbody2D toward a target Transform using MovePosition.

Parameters

Parameter Description
Rigidbody2D The Rigidbody2D to move.
Target The target Transform.
Max Speed Maximum movement speed in units per second.
Finish Distance Finishes when the remaining distance is less than this value. Use -1 to never finish.
Finished Event Optional event sent when the move finishes.

Notes

  • This is useful for 2D chase movement driven in the physics step.