2
\$\begingroup\$

I have a Vector2 and want to move an object towards it... (this vector2 is the mouse position when clicked and I made sure I get only one position when its clicked)

My initial thought was to apply

Rigidbody2D.Addforce(my vector2)

but it acting strangely... How can I push anything towards a point?

N.B: I wanna use physics for it.... because I want to get the pushing feel!

\$\endgroup\$
2
\$\begingroup\$

Nevermind :p I found it!

it works after this

rigidbody.AddForce((whateverObject.transform.position - transform.position).normalized * someFactor);

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .