physics engine misses collisions

Thomas Vogel's icon

My physics setups is 4 x 4 static objects (mass 0) and 4 x 4 falling (and bouncing off) objects. Falling and bouncing works fine, however, collisions are not reported correctly. Some collisions are not reported.

Parameters i send to the physics engine:

sendphys gravity 0. -1. 0, sendphys collisions 1, sendphys worldbox_scale 20 20 20, sendphys fixedtimestep 60, sendphys numthreads 16

I tested different configs for fixedtimestep (higher), maxsubsteps and numthreads .

It also seams. to get wors when run as M4L device inside Ableton.

TFL's icon

Hey, welcome to the forum.

Maybe you need to tweak the jit.phys.world's @numcollisions and @numthreads attributes?

It's hard to debug without an example patcher demonstrating the issue. You might get more and better answers by doing so rather than posting a github link to the full project.
Oh, and when sharing patches here, please use the "Copy compressed" feature (found in the Edit menu), rather than sharing the file itself.

Thomas Vogel's icon

Numthreads i already set 16 .. no change. However it looks not very testable. Sometimes is works well, even in Ableton, sometimes it is 15% collision not reported.

Numcollisions is a get only value. (jit_phys_world: doesn't understand "numcollisions")

What i can say so far, it is not about too many collisions in brief time, it is not about very low or extremely high impulse in collision.

Setting fixedtimestep high results in strange glitches (never-ending collisions with no bounce). What looks promising is high numthreads (at 16 now) and low fixedtimestep (at 30 now).

Hard to say as sometimes it justs works ... I think i give up on this ...

Thomas Vogel's icon

I did not give up un this and i think i solved the problem.

My collision detection problems are gone since i abandoned the ijt.world included physics world. I did it the old-fashioned way, creating my own jit.phys.world.

What also solves another issue i have with the jit.world included physics - you can only access it via sendphys messages to the jit.world and you have very limited information about the current state of the physics world.

fixedtimestep - should be the same as your fps setting for the jit.world, otherwise you may experience some glitches, like double reporting per collision and changes to the speed of the physics engine.

numthreads - probably a promising idea to set to a reasonable high number ... 4 or 8, compared to the default 1