This project has moved and is read-only. 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 9:37 PM
Edited Aug 3, 2011 at 9: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 2:44 PM
Edited Aug 4, 2011 at 2: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 7, 2011 at 12:35 AM
Edited Aug 16, 2011 at 2:40 AM

Thanks @HellGate. I will try this out.

Tried it and it works. Thanks a bunch mate.