This project has moved. For the latest updates, please go here.

How to implement a body chasing another body

Topics: Developer Forum, Project Management Forum, User Forum
Aug 3, 2011 at 8:37 PM
Edited Aug 3, 2011 at 8:38 PM


I am struggling a bit here trying to figure out how I can make one dynamic body chase another one without updating the body position. I was hoping that all i need to do is update the velocity of the chase body. can't figure out how. any help please :)

Aug 4, 2011 at 1:44 PM
Edited Aug 4, 2011 at 1:45 PM

you mean some kind of homing missile? you can do

direction = body.position-chasingbody.position;


and then


or you use the "turning chase" example from msdn and allways apply the force facting the chasingbody

Aug 6, 2011 at 11:35 PM
Edited Aug 16, 2011 at 1:40 AM

Thanks @HellGate. I will try this out.

Tried it and it works. Thanks a bunch mate.