Note that there are some explanatory texts on larger screens.

plurals
  1. POCollision detect with iterative sampling - should I use an engine (box2d) or roll my own?
    text
    copied!<p>thanks for taking the time to read my question.</p> <p>I'm writing a 2d top-down shooter game. It is currently using Box2d as a physics engine. The thing is, it isn't really using Box2d to it's fullest potential, just for collision detection and the underlying velocity/rotation update loop. Any plans to add real physics would simply be eye-candy, not a game changer.</p> <p>Now I chose Box2d because I went through 2 other physics engines, and they just couldn't handle the types of collisions I'm detecting. I'm creating several 'bullets' with very high velocities, and I do not want them to be instant hits on their targets. JigLib and Flixel both had the same problem - bullets were not overlapping enemies at the time of the frame update, and thus were not detected as collisions (i.e. the bullets passed through enemies because they moved to fast).</p> <p>I moved to Box2d because of it's iterative collision sampling, as well as the SetAsBullet method on bodies. And it works great! But now Box2d is giving me troubles too - generating several bullets per second, or at the same time, is severely lowering my fps.</p> <p>So I removed Box2d to confirm that it was not a rendering limitation... added my own velocity/rotation system, and I can fire hundreds of bullets per second. Great! But its lacking any sort of collision detection.</p> <p>So the questions:</p> <p>1) Should I write my own iterative collision engine?</p> <p>2) Should I give Box2d a try again, perhaps with some tweaks to make adding new bodies faster?</p> <p>3) Is there some other alternative, maybe a lightweight physics engine that specializes in this?</p> <p>4) Do you know of any other techniques or design patterns that could be of use?</p> <p>Thanks so much for your help!</p> <p>Edit: I should note, there are not just bullets, but larger, slower projectiles as well. I considered ray casting a line segment to the projectile's previous position, and catching intersections, but that won't work for the larger objects :(</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload