On Sunday, June 29, 2003, at 05:02 AM, curry wrote:
The input could be gun location, bullet speed, target location, target direction, and target speed. The output could be bullet direction or collision point.
Off the top of my head. Meaning there might be several dumb errors you need to fix.
This has to be adjusted for your coordinate system that might be inverted up and down.
Ab = angle of bullet Sb = speed of bullet Vxb = X component of bullet velocity Vyb = Y component of bullet velocity
At = angle of target St = speed of target Vxt = X component of target velocity Vyt = Y component of target velocity
Pxb0 = initial x component of bullet position Pyb0 = initial y component of bullet position
Pxt0 = initial x component of target position Pyt0 = initial y component of target position
Pxb = x component of bullet position Pyb = y component of bullet position
Pxt = x component of target position Pyt = y component of target position
t = time since initial conditions
Initial calculations:
Vxt = St * cos( Ab ) Vyt = St * sin( Ab )
Constraints:
Sb^2 = Vxb^2 + Vyb^2
Pxb = Pxb0 + Vxb * t Pyb = Pyb0 + Vyb * t
Pxt = Pxt0 + Vxt * t Pyt = Pyt0 + Vyt * t
At collision:
Pxb = Pxt Pyb = Pyt
Solve above 7 equations for Vxb. From that you can get the point of collision. Is that enough equations?
At = tan(Vyb/Vxb)
Dar Scott
_______________________________________________ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
