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
@physicsWorld = new CANNON.World()
@physicsWorld.broadphase = new CANNON.NaiveBroadphase()
@physicsWorld.gravity.set(0, 0, 0)
@physicsWorld.solver.iterations = 10
@physicsWorld.defaultContactMaterial.contactEquationStiffness = 1e6;
@physicsWorld.defaultContactMaterial.contactEquationRelaxation = 10;
And two bodies:
@debugCubeBody = new CANNON.Body({
mass: 1,
shape: new CANNON.Box(new CANNON.Vec3(1, 1, 1)),
position: new CANNON.Vec3(20, 0, 0),
quaternion: new CANNON.Vec3(0, 0, 0),
velocity: new CANNON.Vec3(1, 0, 0)
})
@physicsWorld.addBody(@debugCubeBody)
geom = new THREE.BoxGeometry(2, 2, 2)
mat = new THREE.MeshBasicMaterial({
color: 0x00FF00,
wireframe: true
})
@object = new THREE.Mesh(geom, mat)
@scene.add(@object)
dimensions = new THREE.Box3().setFromObject(@object).size()
@body = new CANNON.Body({
position: new CANNON.Vec3(0, 0, 0),
shape: new CANNON.Box(new CANNON.Vec3(dimensions.x, dimensions.y, dimensions.z)),
quaternion: new CANNON.Vec3().copy(@object.quaternion),
mass: 1
})
@world.addBody(@body)
However, when one of the bodies comes near the other, an error occures.
polyB is undefined, because closestFace never gets set. At this point i'm out of options.
I hope i have provided you with enough information.
The code is written in coffeescript, but this should be understandable from a javascript's perspective.
The text was updated successfully, but these errors were encountered:
Hi,
I set up a world using this code:
And two bodies:
However, when one of the bodies comes near the other, an error occures.
polyB is undefined, because closestFace never gets set. At this point i'm out of options.
I hope i have provided you with enough information.
The text was updated successfully, but these errors were encountered: