Collision problems and shooting.

I’m making a little low-poly air fight game and have some problems with the collision. I start shooting when the model is still and everything is okay then I start to move faster and faster and at some point it goes insane. The problem is that whenever I shoot the projectile collides with the model because the model traveled too fast so they collided and that gives the model a push at some direction. How can I make the projectile inherit the forces of the model? Also how can I make the collision bounds better? Changed the collision of the model to Convex Hull with 0 margin. It got a lot better but it still sinks into other models.

For shooting weapons I highly suggest using Rays instead of physical bullets. If you want you could still make the bullet appear, but not do anything.

A ray should work every time with no problems and ‘collision’ won’t matter. You can do a lot with the ray sensor without Pyhton, too.

Good luck!

Rays? Thats new for me. Where can I find it and how can I use it?

Logic Bricks - Sensors.
Here is a video of some of the uses of a ray. (it does use python)

Well the problem is that the rays travel the distance instantly while the projectiles have travel time. :confused:

You can also ray cast from the bullet itself instead of the gun, so you still get the movement of the bullet, but the accuracy of the ray. Just adjust the range to something short enough to pass for collision, but long enough that the bullet doesn’t pass into the collision bounds.

You might want to turn ghost on in the physics property of the bullets too, so that they don’t bounce off of your ship and each other and whatever else.

Edit: :yes:

With collision detection, set the bullet to ghost so it won’t affect the target at all.
Edit: Hobomatic beat me to it.

Now I have another problem :frowning: I added the ray and it works but only some times. Looks like the projectile is too fast. How can I make it detect all the time?
I shoot the wall and only a few times the ray detects it’s there.

Since the projectile is going so fast the distance of the ray also must be greater, so the position before going through the wall is not too far from the wall. Set the range to something higher, 0.5 works.

Personally I think it would be better to use collision on the projectile, so you won’t be needing pulse mode. The ray sensor may be faster as collision, but I think ray sensor on every logic tic will cost you more in performance than having a collision sensor running just one logic tic. Also the cost of a collision sensor on a bullet is practical non-existing anyway.

Edit: With the collision sensor use ‘Sensor’ type and ‘Capsule’ for collision bounds. With a script on the projectile running when it hits an object you can get the hit object with sensor.hitObject.

Thanks :slight_smile: I use rays because I have problems with the collision. It affects the ship too and thats a big problem. Also, it’s a low-poly little game, I don’t think performance will be the problem :slight_smile: