Js phys.world retrieve collisions in script

May 24, 2013 at 7:04am

Js phys.world retrieve collisions in script

Hi

is it possible to retrieve information about the collisions made ​​between objects in javascript like the dumpout outlet in a patcher (knowing that all objects are instantiated in javascript, my 3D scene, my world etc…) I have examples like the ragdolls etc…to create objects but I did not find any solutions to retrieve collisions datas

thanks

#250577
May 24, 2013 at 11:01am

check out the following example patch:
Max 6.1/examples/jitter-examples/render/physics/phys.world.collisions.js.maxpat

#250605
May 24, 2013 at 3:54pm

one more time , thanks

BUT,
I have observed that the “duration” of contact remains at 0, can someone reproduce this default or it’s only me ?

#250630
May 24, 2013 at 4:22pm

ugh, yeah, that’s a bug.
thanks for catching, we’ll get it fixed up.

#250637
May 24, 2013 at 5:19pm

may be you will be able to suggest me ideas, I want to make a roll of the dice, I must determine on which side falls my cube.

During the collision report, the attribute ‘normal’ refers to the orientation of my item? I have to work from there?

#250643
May 24, 2013 at 9:38pm

so turns out this is a simple fix.
you must simply free the individual collision-dicts when done processing them.
so in the example javascript, add the following line at the end of the process_collisions function (line 50 or so):
subd.freepeer();

the collision normal won’t tell you which side of the cube is facing up.
you should be able to determine that simply from the body’s orientation (quat, rotate, or rotatexyz attributes).

#250645

You must be logged in to reply to this topic.