Homing Missles // Error when target is Destroyed
I’m working on a project for a Gundam game that uses homing missles. To lock in on the target the object uses the position of the target versus its own to orient itself towards the object. Pretty simple tracking system, since local movement is localized to forward movements only. (refer to http://solarlune-gameup.blogspot.com/2011/05/python-in-bge-part-8-ai.html )
Anywho, the problem is when the target of the missle is destroyed. To pass the info on which target to track to I had to assign it directly into the object. So when the object dies the rocket is still pursuiting an object that has now been removed from the scene. Since it’s missing from the scene the heat seaker spazzes out and creates some ridiculous lock down error.
How do we account for an object being in the scene…
if obj[“lockedOn”] not in the scene:
fly towards obj[“lockedOn”’]
What is the function to test for this?