Moving a rigidbody towards the mouse position

Hello everyone! I would like to know if anyone could help me with a bit of an issue (obviously :p).

The set up I currently have moves the player (a sprite) towards another object that is set to the mouses position on the x and y axes (yes, in case you didn’t know, that is the plural of axis). I accomplish this with the “Vector3.moveTowards()” function. Now, this works great, the movement is nice and smooth and almost everything is suitable. Almost. The issue I’m running into is collion, specifically the player being able to move the ship out of the bounds of the screen. So I was hoping maybe there was a way to move a rigidbody (the player in this instance) towards an object (the object that is set the mouses position) without rotating the rigidbody? That is probably very vague, but that is the only way I can think of describing the issue.

Any assistance would be much appreciated.


and a specific ForceMode (Impulse). You’d just have to make sure you stop it when you reach the target.

rigidbody.ApplyForce(rigidbody.velocity *-1, ForceMode.ChangeVelocity);


rigidbody.velocity =