Sign up ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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!

share|improve this question

1 Answer 1

Nevermind :p I found it!

it works after this

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.