detect collisions between frames

julienrobert's icon

I have difficulty to detect collisions between frames when the framerate is low (for any reasons, the frame rate could decrease and then I have the problem).

to show the problem clearly, I put my qmetro at 60ms. When I use a qmetro at 15ms, we still miss collisions sometimes but more rarely… but I want them all!

test-boules.maxpat
Max Patch
Rob Ramirez's icon

i believe the only way to ensure you catch notifications for every collision is to have the physics world timestep and renderer framerate be equal, and therefore have maxsubsteps = 1.

otherwise there's a chance more than one physics step will happen between render frames, and if the collision happens in those substeps, then the report will not get fired. the collision report is an output of all *currently* colliding objects.

do do this make sure your phys.world @fixedtimestep attribute is equal to your framerate.

julienrobert's icon

alright, thanks.

julienrobert's icon

In the same direction, I'm trying to create a musical instrument that reacts rhythmically. Do you think there is a way to be sure that all the objects (spheres in my case) move in precised calculated time?… In that joined patch, I send the sphere with a velocity calculated to make it travel in a certain amount of time (1000 ms.). But, even if I turn overdrive on and audio interrupt on, the travel time still moves and the movement becomes late or early.

The metro is locked to the tempo at 64n.

any inputs are welcome

thanks

test-boules.maxpat
Max Patch