3D object to object collision physics with JS
-
Hi,
Wishing the Isadora community good spirits for the season!
I have been working on updating the 3D object collision options in Isadora. Specifically to detect boundary collisions and object–object collisions in 3D space. The patch attached below is an offer to anyone interested in using 3D models and provides position and rotation outputs for the Isadora 3D Player actor: translate x,y,z and rotation x,y,z to simulate objects colliding, pushing and bouncing off each other and also bouncing off a boundary box aligned to 3d space. The actor provides inputs as follows:
- dt (recommended as a constant pulse input at 60hz)
- bounding box H,W,D (use in conjunction with a 3D Stage Orientation actor in the scene editor- move along the z axis to fit the stage)
- radius (the size of the collision detection relative to the size of the 3D object edge. This is based on a sphere.)
- bounciness of the object collisions
- initial speed of the objects when reset
- floaty to liveliness of the movement
- reset (retrigger)
A limitation is that the actor assumes the 3D objects are all a similar size for collision detection.
the actor is easily modified for the number of 3d objects in the scene. Just one line in the code is changed relating to BODY-COUNT (the number of 3D objects in the patch). The corresponding outputs are then available by adjusting the number of outputs of the actor. (Each object has six outputs associated with translation and rotation)
here is 3DCollisionJS_2025 for Isadora 4, code assisted by copilot.
Best Wishes,
Russell