You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let vertices: CANNON.Vec3[] = [
new CANNON.Vec3(1.6914, 0.524775, 1.102675), // 1
new CANNON.Vec3(1.7181, 0.581274, 2.075575), // 2
new CANNON.Vec3(-4.1381, -1.222925, -4.314225), // 3
new CANNON.Vec3(0.7285, 0.116874, 1.135975), // 4
];
let faces = [
[2, 1, 0],
[3, 1, 2],
[3, 0, 1],
[3, 2, 0]];
let chassisShapeComplex = new CANNON.ConvexPolyhedron({
vertices: body,
faces: facesNotTriangulized
});
let chassisBody = new CANNON.Body({
mass: this.bodyMass,
position: new CANNON.Vec3(0, 10, 0), //cars spawn 10 meters in the air.
material: bodyMaterial,
collisionFilterGroup: 1,
collisionFilterMask: 2 | 4
});
chassisBody.addShape(chassisShapeComplex);
let trackStart = new CANNON.Body({
mass: 0, // mass = 0 makes the body static
material: this.groundMaterial,
shape: new CANNON.Box(new CANNON.Vec3(10, 1, 50)),
position: new CANNON.Vec3(0,-10,2),
collisionFilterGroup: 2,
collisionFilterMask: 1
});
(rough copy paste of my code)
and drop it onto a static Box (under normal gravity 0, -9.82, 0) (here 'trackStart'), the collision isn't calculated correctly and the convexPolyhedron glitches into the box. It works if i create a compound body out of the 4 triangle faces!
I for the life of me couldn't make a jsFiddle with three.js and cannon.js working, so I hope you can reproduce the bug with this much.
I can also supply the whole project im working (on with the bug), if needed.
I'd be very grateful if someone could share some ideas, as to whats going wrong.
The text was updated successfully, but these errors were encountered:
When i create a convexPolyhedron with the values:
(rough copy paste of my code)
and drop it onto a static Box (under normal gravity 0, -9.82, 0) (here 'trackStart'), the collision isn't calculated correctly and the convexPolyhedron glitches into the box. It works if i create a compound body out of the 4 triangle faces!
I for the life of me couldn't make a jsFiddle with three.js and cannon.js working, so I hope you can reproduce the bug with this much.
I can also supply the whole project im working (on with the bug), if needed.
I'd be very grateful if someone could share some ideas, as to whats going wrong.
The text was updated successfully, but these errors were encountered: