Open IRobot1 opened 2 years ago
I found NgtCannonUtils.getUUID(ref, index). This could be called like
this.physicConstraint.useDistanceConstraint( NgtCannonUtils.getUUID(instancebody.ref, instanceA), NgtCannonUtils.getUUID(instancebody.ref, instanceB), {});
but unfortunately, there's no useXXXConstraint method that takes two uuid strings. Perhaps there could be a duplicate methods that supports instance body and two indices
useDistanceConstraint(instBody: Ref
The existing private useConstraint could be split up to handle objects or uuids and the new methods could use the uuid version.
Does this seem reasonable?
Created pull request for supporting constraints against instance mesh.
Added variation of physics clump to sandbox examples that limits distance from center using fixed distance constraint using instance bodies.
Physics bodies can be created against instance meshes. The index can be passed to the body function
Internally, this creates a virtual UUID that's passed to cannon.
However, constraints are missing a way to refer to instance bodies using the virtual UUID. Currently, only non instance bodies are supported.
My guess is a check if objects are InstanceMesh would need to be added here to lookup the internal UUID.
Am I on the right track?