- Joined
- May 10, 2020
Does anyone have any experience implementing their own physics engine?
I need some advice on the broad phase collision detection. The way I do it at the moment is by using a uniform grid and every frame I clean up all cells that had objects inside of them and re-insert the objects, every time an object is added to a cell that already has objects in it, the grid reports potential collisions.
Thing is, by cleaning up all "dirty" cells I'm going against the advice of updating the objects, that is storing the ids of cells they take up and only removing them from the ones they no longer occupy and adding to ones they occupy now. I think it's fine, cause the majority of objects are moving around, but in 1/60 of a second they won't manage to move that far and will mostly occupy the same cells.
So... I dunno. What do you guys think?
I need some advice on the broad phase collision detection. The way I do it at the moment is by using a uniform grid and every frame I clean up all cells that had objects inside of them and re-insert the objects, every time an object is added to a cell that already has objects in it, the grid reports potential collisions.
Thing is, by cleaning up all "dirty" cells I'm going against the advice of updating the objects, that is storing the ids of cells they take up and only removing them from the ones they no longer occupy and adding to ones they occupy now. I think it's fine, cause the majority of objects are moving around, but in 1/60 of a second they won't manage to move that far and will mostly occupy the same cells.
So... I dunno. What do you guys think?