Hello, I am trying to make some basic program, where im using cannon physics.
I have made a “tennis racket” by using parent and children, rather than merging meshes, due to collision interactions. An example of my code for this is in this playground link:
https://playground.babylonjs.com/#AVUGIA#4
if this link doesn’t take to the right page let me know and ill do it again
when i have a controller in my xr setting, i try to use mesh.physicsImpostor.setLinearVelocity(BABYLON.Vector3.Zero());
i use the tenisNet, to apply this to (tenisNet.physicsImpostor…)
when i press the button (ill put the code below the rest of the text) it crashes the xr experience.
I have used this with singular shapes with no connections and it works as expected
The code that is used for the controller is:
xr.input.onControllerAddedObservable.add((controller) => {
controller.onMotionControllerInitObservable.add((motionController) => {
motionController.getMainComponent().onButtonStateChangedObservable.add((component) => {
if (component.changes.pressed) {
if (component.pressed) {
tenisNet.position.y = 1;
tenisNet.rotationQuaternion = new BABYLON.Quaternion();
tenisNet.physicsImpostor.setLinearVelocity(BABYLON.Vector3.Zero()); // this causes the xr to crash, due to it being a mesh with children
}
}
});
})
})
Thanks to anyone who can provide any help