Collisions or distance checking

I’m working another weapon for my racing combat game. This weapon is going to follow the track until it finds an enemy racer and then it will lunge at them and explode.

My question is whether I should have a large collision sphere to check for nearby enemies, or if I should give the weapon a list of all the cycles on the track and have it check the distance to enemies. I figure that the distance checking will be faster/more efficient, but I thought I’d ask anyhow.

A large collision sphere is essentially the same thing as a distance check, with the advantage that it is handled for you by Panda, in C++, rather than in Python which is generally slower.

So, other things being equal, the sphere is probably faster. You do have to exercise the standard caution with collisions, of course (in particular, make sure your bits are set appropriately so that the sphere is only detecting collisions with the appropriate targets).

David

Ah, excellent. Setting up the sphere will be easier than setting up the distance checks. Thanks, David.