I have a pretty basic problem here, and I'm wondering if there is any more effective and painless method of fixing it.
I have a problem of units shooting and hitting themselves, right when the missile is created.
This could easily be solved by storing who is the shooter in a field in the missle, and not have the missile collide with the shooter.
However, I have a system with magnets and stuff where the shot can be flung back at you. Having the shooter not being able to shoot himself fails then.
A second possibility would be to have a delay on the missile until it starts colliding with objects. However, this caused other troubles. When I had a very slow and big missile, the delay wasn't enough, and the unit collided with his own missile anyway. I fixed this by making the delay longer. However, when the unit shot a missile really fast, enemies that are too close was also skipped due to the now longer delay.
So, what other tricks can one use to avoid this simple yet troublesome problem?
I have a problem of units shooting and hitting themselves, right when the missile is created.
This could easily be solved by storing who is the shooter in a field in the missle, and not have the missile collide with the shooter.
However, I have a system with magnets and stuff where the shot can be flung back at you. Having the shooter not being able to shoot himself fails then.
A second possibility would be to have a delay on the missile until it starts colliding with objects. However, this caused other troubles. When I had a very slow and big missile, the delay wasn't enough, and the unit collided with his own missile anyway. I fixed this by making the delay longer. However, when the unit shot a missile really fast, enemies that are too close was also skipped due to the now longer delay.
So, what other tricks can one use to avoid this simple yet troublesome problem?