Hey @gkjohnson, I’m currently trying to slightly modify your Sphere physics collision Demo but running into some issues that I can’t seem to find documentation on.
Essentially, I’m trying to add some rotation to the gltf collider mesh on pointermove
and have any balls in the scene respond to that rotation physically, here’s a short clip of what i’m referring to…
what I have tried:
I have added the visualizer
, collider
, environment
objects to a container object3D so this can be rotated, made staticGenerator
a global variable so it can be accessed from within the pointermove
event and then trying to refit
the bounds tree of the collider geometry when rotation happens eg…
renderer.domElement.addEventListener("pointermove", (e) => {
mouse.x = (e.clientX / window.innerWidth) * 2 - 1;
mouse.y = -(e.clientY / window.innerHeight) * 2 + 1;
container.rotation.x = mouse.x
container.rotation.z = mouse.y
container.updateMatrix()
container.updateMatrixWorld();
if(staticGenerator){
staticGenerator.generate( collider.geometry );
collider.geometry.boundsTree.refit();
}
});
this looks like it’s making the balls slightly react to the rotation of the gltf collider but it’s not stable at all, very jumpy and balls end up going through the gltf collider geometry where there are freezes in the regen process…
I’ve tried to find reference to some sort of DynamicGeometryGenerator
in the three-mesh-bvh lib with no luck so far so decided to come to the source and see if you’d possibly have some idea how this physics functionality would be best handled or implemented with the smoothest response times?
EDIT: omitting the following lines vvv
from the above code ^^^
… everything runs smooth as butter…
//container.updateMatrix()
//container.updateMatrixWorld();
EDIT EDIT: there’s definitely still something off vvv
but i think this is likely the way I’m making rotations on the parent of the visualizer
, collider
and environment
object rather than “absolutely” on these objects individually…