Game Development Community

perdictive fireing

by Joseph Bosch · in Game Design and Creative Issues · 05/22/2012 (11:33 am) · 0 replies

I am trying to get an object that predicts where its target will be so that it can fire at the position to hit it

logistics

target a is at location -250, 250 traveling at a speed of 5 per cycle on both the x and y axis towards ti target, Target b is at location 0,-250, stationary and fires an object traveling at 10 per cycle. what is the exact location target b should aim at to hit target a, assuming target a maintains velocity.

what I got so far is to take your distance divide by relative speed to get time and then multiply time by the speed of one of the objects which gives you how far away you intercept the object take that and add or subtract it from your objects x or y to get the x or y of where you will hit. now the problem is that since we are moving on a multi denominational plane we need the object to arive at both X and Y at the same time (other wise it just looks bad) this means you have to adjust the speed of X and Y while maintaining relative speed which I am still working on