Answer the question
In order to leave comments, you need to log in
How to push an object using AddForce without taking into account the length of the vector, but only in the direction?
There is a vector (the difference between the position of the player and the mouse click) and you need to push the object along it using AddForce, but so that only the direction of the vector is taken into account, and not its length.
How can I do that?
Answer the question
In order to leave comments, you need to log in
magic is your vector
Vector2 direction = magic.normalized;
GetComponent<Rigidbody2D>().AddForce(direction);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question