Hi Oz
As far as I am aware dynamic chasing dynamic using a transition.to doesn’t work.
The other issue with transition.to is that the time it takes to reach the target will be the same regardless of distance, so the further way the target is the faster the chasing object will move.
To get around this what I do is to work out the angle between the two objects and then use some weird maths magic to move the objects like thus…
local angle= math.atan2(target.y - missile.y, target.x - missile.x) -- work out angle between target and missile missile.x = missile.x + (math.cos(angle) \* missile.speed) -- update x pos in relation to angle missile.y = missile.y + (math.sin(angle) \* missile.speed) -- update y pos in relation to angle
The bonus of this method is that it works regardless of wether the target is moving or not, and the missile will always move at a constant speed (unless you increase it).
Hope that helps. [import]uid: 7841 topic_id: 16965 reply_id: 64303[/import]