Phys.obj collision problem with convexhull/concave
Hi!
I have a patch with collision detection from a jit.phys.body (collisions 1). When I set this jit.phys.body as a cube, there is no problem, but when I connect it to a jit.gl.gridshape (matrixoutput 1) and set it to shape convexhull or concave, it doesn't work properly.
With convexhull, the duration stays at 0., even if the collision lasts.
With concave, there is no collision detected.
Do you know why this behaves like this? Any hints?
Thanks a lot!
is your matrixoutput enabled object continuously outputting (e.g. automatic 1)? this may prevent proper simulation behavior. hard to say without seeing the patch.
Hi Rob, thanks for your answer!
Yes, the matrix is continuously outputting with automatic 1. How should I do it differently if I want the shape to move/adapt or other and thus refreshing regularly? My patch is huge, so I attach here just a little part, with the main physics elements. Let me know if you see something wrong.
Thanks a lot for your help!
convexhull and concave type body shapes are only for static mesh data. dynamicmesh types support modifying the shape dynamically, but must be static in the simulation (e.g. mass 0).
for modifying the spatial transform (position, orientation and scale) you must decide if the shape is entirely controlled manually, rather than part of the simulation. in this case it is a kinematic body (@kinematic 1). Otherwise if you want the body acted upon by simulation forces, then the only way to control it is via simulation forces, such as impulse messsage and force/torque attributes, or an external force like from a jit.phys.ghost.
hope this helps clear things up.
Thanks a lot Rob, this helps me understanding better the needed context for each shape type!
More questions:
- Is there a way (except with convexhull, which hasn't the possibility to have holes) to have a filled solid, not only a mesh? I would like my collision report not to be triggered only when touching the edges of the shape but also when the object is within.
- How would be the best way to get a signal when the collision stops? I use the duration value of the collision dictionary to know when the collision is still active but when it stops there is no "stop" signal given, the collision dictionary just freezes at its last state. I would like to avoid adding a metro or delay to constantly check if the duration is still changing or not. At first, I thought to do it with the impulse value (which goes to 0 when the collision stops) but this doesn't seem to be working with a manual control of the shape (@kinematic 1).
Thanks a lot!
@Rob or somebody else. Any ideas on this? I keep searching on the forums and all and can't find a way to solve it. Thanks! :)
One more question to this topic:
Performance-wise, is it better to have one big dictionnary on the main object, outputting all its collisions with my 19 surrounding objects, or a separate dictionnary on each surrounding object (19 in total), each one outputting its collisions with the main object?
to detect collisions inside an object you likely need to use a phys.ghost object.
to detect the end of collisions you need to create your own debouncing logic. easily enough with a delay (and probably deferlow)
you'll have to run your own performance comparisons, I couldn't say which is better. I would go with whatever works best for your setup, as I can't imagine it makes a huge difference on performance.