I tried implementing the tracking code for Starburst Missile onto ZK gadget which control airplane landing . I found out that it (will) behave just like the clunky Spring 96+ landing bug, where airplane can go further and further away from the airpad and took long time to return.
Well, what did happen?
My theory is:
the tracking code (which is a math operation) tell the airplane to go backward toward the airpad (if it goes further away from airpad), but the problem is: if the airplane is facing away from the airpad then the airplane couldn't possibly go backward. The code expect it to stop in mid-air & go backward, which is invalid behaviour. So the airplane keep going forward and never stop.
This is the code that gave me those behaviour when I applied it on airplane: (I translated it to LUA)
Code: Select all
float3 targetErrorVec = (targetPos - pos).Normalize();
targetErrorVec = targetErrorVec - dir;
targetErrorVec = targetErrorVec - dir * (targetErrorVec.dot(dir));
targetErrorVec.Normalize();
dir = (dir + (targetErrorVec * turnrate)).Normalize();
CWorldObject::SetVelocity(dir * speed.w);