AddForce to object

You cannot expect anyone to comment on this because it’s not even valid code. If you have a script question then please post valid script using code-tags .

Calculate the direction, normalise it, scale it by time or speed (if you wish) and manipulate the velocity by either indirectly adding as a force or setting the velocity directly. There is no “properly”, there’s only how you can/need to do it in your project given how your stuff needs to move/interact etc.

Also, use Vector2 for 2D, not Vector3. If you normalise a Vector3 and it has a non-zero Z value, it’ll be normalised along with that affecting the unit-normal produced.

1 Like