[Solved] Fired bullet returns to zero degrees when object that fired it is deleted

Good day! I have set up an aircraft to do some carpet bombing. It goes over an area, drops one every second or so. The dropped bombs will fall a few seconds before hitting the ground and exploding. Everything seems to work fine until I noticed that if the aircraft gets destroyed and deleted, any bombs that haven’t exploded yet will change direction to zero degrees. They still explode after the set time, just their change of direction isn’t exactly ideal. I tried searching for similar posts here but can’t seem to find them.

Attached is the events involved. I’ve moved stuff around a bit in hopes of correcting this, like setting a variable to false and using permanent instead of instant force, stopping it first by removing all forces, or some other stuff.

A possible solution I have in mind at the moment is setting up an invisible target object linked to each instance so they have to stay trained to that target object. I’m not yet sure if that would work, but I was wondering if there might be a simpler solution? Or if anyone has had similar experience?

Hi, this is quite a wall of actions in your blocks.

I cannot really point to a specific line that creates this problem but if you reference your aircraft for the direction of the bombs somewhere, this might be the problem (if the aircraft doesn’t exist anymore, by default the 0,0 coordinates will be used by the engine). Using a target object is probably the better solution.

1 Like

The only time the aircraft is referenced is when they’re created. After that I have separated their actions independent of the aircraft. Which is why I’m finding myself rather stumped.

Though I think I see what you’re getting at. It seems I set the creation of 3 bombs from one single action. If the aircraft has been deleted while the actions hasn’t been completed yet, the new bombs will have no reference for their direction nor the coordinates for where they should be created. These appears to affect the bombs already created since the actions look for newer ones but there are none.

So yeah, You’re right. I just tested it. I have to separate the creation of each bomb so that they are only created as long as the aircraft object still exists. Thanks so much!!!

1 Like