Hi
I did this once....
Your missile have an angleX, Y and Z (and movement in the same direction)
From the start this angle is the same as the aircraft
Then for each frame calculate the angle between missile and target
Decide how well the missile should follow the target.
You get something like this:
newMissileAngle += (toTargetAngle - missileAngle)/10
If you use a lower amount than 10 the missile turns quicker and follow
more accurate.
you can also ad a minimal possible angle:
newMissileAngle = Math.max(newMissileAngle, minAngle)
voila
jens
Le 29/03/2011 13:47, Julien a écrit :
Hi all !
I decided to change my program to away3d 3.6 (I was 3.4 so big jump).
Do you have any idea on how i could follow a target smoothly in a 3D
environment ?
I am making a Flying arcade game where aircraft can shoot missile on
other aircrafts.
When i did my own calculation :
Aircraft forward vector
Aircraft to target vector
normalize both
dotProduct of them
acos ( dotProduct ).
Work 10% (If the aircraft send missile while being reverse, the
missile go to opposite direction of target...).
I also tried to use lookAt function
So i create a dummy object, lookAt the target and my missile copy the
dummy object rotation X,Y,Z with a linear tween movement. (but it
wasn't successfull also).
In fact some of the rotation are limited to 90° and that make me very
confuse.
Any idea ?