Hello everybody, hope you are doing well. I need help of pro webgl dev.
I created box in three.js and for collision effect I added box in cannon.js too.
But width property of three.js and cannon.js are different.
Actually, it was double in cannon.js.
I’m attaching the code:
-three
const playerGeo = new THREE.BoxGeometry(1, 1, 1);
//const playerGeo = new THREE.BoxGeometry(2, 2, 2); Setting it up like this works fine.
-cannon
const boxBody = new CANNON.Body({
mass: 5,
position: new CANNON.Vec3(0, 3, 0),
shape: new CANNON.Box(new CANNON.Vec3(1, 1, 1)),
});
Thanks.