Collision Ray or Full Collision - Bullits

What do you all think I should use? My goal is to have the bullit make a sound when it hits something-- either it be a texture or a player (or aka when something hits dirt it makes a dirt inpack or if it gets something like a player it makes a human taking a bullit inpack sound.) Should I let the bullit do this or should I just have no collision on the bullit and send a ray? I ask cause, I have to many collision pass for my bullits (unless theres a better way to lower this) and it has caused my game to run slow. Not sure whats really wrong unless somehow is some sorta limited by my CollisionTraverser()…?

Not sure I understand what choices you think you have? You want to model the bullets as rays? Depending on what kind of physics you want and how accurate you want your representations to be, there are several ways you can do this. Off the top of my head…

  • You could just shoot a single ray, then use a lerp interval to animate the bullet flying towards that point. This would work if you had a leeway on how accurate you want a bullet representation to be. (ie: not very)

  • Model the bullet as a line segment and do collisions based on this. You’ll have to adjust the line segment based on the bullet’s velocity to prevent it from missing a physics tick.

  • A non-collision system; If you’re doing something like an RPG game, then it’s not necessary to do any collision at all. Just roll the dice and see if a hit occurs or not, and then animate it. (Using lerp’d bullets as mentioned.)

The built-in Panda physics works okay for a small number of active collisions, but I’ve found that if you have a lot going on at once it can bog down pretty fast. It’s important to keep as much of your geometry in easily-cullable segments and minimize overlaps. (My worse-case scenario is something like a missile flying low over a polyset terrain – this generates a lot of possible collisions per tick, so it’s necessary to keep the terrain mesh fairly segmented.)

Also use as simple a representation as you can. Spheres colliding with spheres or planes are fast. Rays are generally fast. Anything else runs the risk of brute force per-triangle checks.

long answer short. for colliding bullets use rays.
if your bullets are more like cannonballs with parabolic motion. you might prefer a collisionparabel.
bullets usualy are ways to fast to let their actual geometry collide. even collision segments are overhead.

Of course it depends on the complexity of the scene; and how you set up the from and into colliders in the scene. I was alarmed to see that 45ish from collision spheres seemed to handle ok.

Also depends on what you are going for if you mean bullets; rays are generally the correct answer if your bullets are moving FAST (like most bullets do). You can always figure out if its going to be a problem by finding how fast it will move in one frame, and see if that value is enough to make it completely pass through another objects collision geometry.

I stayed away from rays and had relatively fast moving objects, seemed to work ok with collision spheres on fairly large geometries.

Geometrically, a collision between a ray and pretty much anything is a single bounds check, which is fairly quick. Collision between a sphere and pretty much anything is a single distance check, which is fairly quick. What you should NOT do is a geometry-based collision, if you can avoid it, since that will be essentially one bounds check for each polygon in the geometry. Ray, Sphere and Parabola I’d guess will be mostly equivalent speed-wise, they just have trade-offs as far as what you want the mechanic to accomplish.

All very good advice but mostly generalized… Maybe it would help if adr described what was their intent?

And neat, somehow missed over the CollisionParabola in my examinations of the docs. This is exactly what I need to implement my ballistic weaponry. :slight_smile: