Forums > Javascript

Js phys.world retrieve collisions in script

May 24, 2013 | 7:04 am

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


May 24, 2013 | 11:01 am

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


May 24, 2013 | 3:54 pm

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 ?


May 24, 2013 | 4:22 pm

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


May 24, 2013 | 5:19 pm

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?


May 24, 2013 | 9:38 pm

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).


Viewing 6 posts - 1 through 6 (of 6 total)