Gun fire but bullet pass all of my rigid bodies.

ahmadi

04-10-2006 09:10:45

Hi :D
i have a gun that user can fire with it, but after that i shoot a bullet (a small NxOgre Sphere) with a startup velocity , the Sphere pass all objects without any collision!? Why? i think this caused by physic Simulation that dont detect collide between two object because one of them have high speed velocity.
ok, but how can i fix this problem? maybe PhysX have a extension tools or ... to i simulate gun fire?

betajaen

04-10-2006 10:12:16

Use CCD or Rays.

foxbat

05-10-2006 02:42:28

The simulation only does collision checking at discrete, regular inveval. A fast moving object may be on one side of another object for one check, and on the other side for the next check. In order for a collision to occur, the two objects must have intersecting positions at a time when a collision check takes place.

What CCD does is allows continuous collision detection for objects which have special CCD physics shapes. CCD is slower than regular collision however, and you will have a performance hit just for having CCD mode enabled, even without any CCD objects.

I think you'll find that using ray-checks is faster than CCD. Just run a ray check between the initial and final positions of your bullet at each time step, and remove the bullet model completly from the physics simulation.

M@gg!

05-10-2006 20:06:56

I think you'll find that using ray-checks is faster than CCD. Just run a ray check between the initial and final positions of your bullet at each time step, and remove the bullet model completly from the physics simulation.

The MagazineStorage might be of some help in this task. ;-)

jacmoe

05-10-2006 20:09:42

Handy piece of code, M@gg! ! :)

M@gg!

08-10-2006 14:36:53

THX :)


By the way, I'm still searching for testers!