Page 1 of 1

body lag when many shapes #love.physics #box2d

Posted: Fri Aug 10, 2018 1:46 pm
by chu
Hellö dear devs,

I have a question about physics.

I'm currently trying to build a sandbox, some kind of space minecraft with gravitation laws applied, but I've been stuck for a long time with the Body/Fixture/Shape trio.

In my game, i have what i call molecules, made of atoms.

A molecule has a Body, and an array of Fixtures(+Shape) attached to it (the atoms).

When two molecules collide, my goal is to merge them into one molecule.

My problem is that when i add a lot of Fixtures(+Shape) to a Body, the game is exponentially laggy :(

Does anyone know if :
- there's a simple solution ? a setting like friction, damping or whatever that i can change ?
- this is a box2d limitation ?
- this is the current implementation of box2d in love2d limitation ?
- this is my f****** code that is limited ? :ultraglee:
- there is an other physics engine that allow me to build shapes with a lot of edges / build bodies with a lot of shapes

Thanks for your attention !

Image