leon wang

Members
  • Content count

    4
  • Joined

  • Last visited

  1. in cannon.js you can set allowsleep = true of cannonworld to avoid this.
  2. save button on playground not working fro me right now, can you guys please copy below codes and try? cubes will fall in 20 secs normally. thanks. BTW, love your show on MVA var createScene = function () { var scene = new BABYLON.Scene(engine); var gravityVector = new BABYLON.Vector3(0, -9.81, 0); var physicsPlugin = new BABYLON.OimoJSPlugin(); scene.enablePhysics(gravityVector, physicsPlugin); var ground = BABYLON.Mesh.CreateGround("ground", 200, 200, 100, scene); var mat1 = new BABYLON.StandardMaterial("mat1", scene); mat1.diffuseColor = BABYLON.Color3.Gray(); mat1.wireframe = true; ground.material = mat1; ground.physicsImpostor = new BABYLON.PhysicsImpostor(ground, BABYLON.PhysicsImpostor.BoxImpostor, { mass: 0, restitution: 0.9 }, scene); //build cubes var mat_cube1 = new BABYLON.StandardMaterial("mat_cube1", scene); mat_cube1.diffuseColor = BABYLON.Color3.White(); var mat_cube2 = new BABYLON.StandardMaterial("mat_cube2", scene); mat_cube2.diffuseColor = BABYLON.Color3.Black(); var p = {x:0,y:0,z:-40}; [10,9,8,7,6,5,4,3,2,1].forEach(function (y) { [1,].forEach(function (x) { [1,].forEach(function (z) { var box = BABYLON.Mesh.CreateBox("cube_" + x + y + z, 1, scene); box.position = new BABYLON.Vector3(p.x + x , y - 0.5 , p.z + z ); //mat2.wireframe = true; ; //set physic box.physicsImpostor = new BABYLON.PhysicsImpostor(box, BABYLON.PhysicsImpostor.BoxImpostor, { mass: 0.1,friction:1, restitution: 0.1 }, scene); box.physicsImpostor.physicsBody.allowSleep = true; //box.physicsImpostor.physicsBody.isStatic = true; if ((x + y + z) % 2 == 0) { box.material = mat_cube1; } else { box.material = mat_cube2; } }) }); }); //create light var light = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(0, 10, 0), scene); light.intensity = 1; //create camera var camera = new BABYLON.FreeCamera("camera1", new BABYLON.Vector3(10, 15, -80), scene); camera.setTarget(new BABYLON.Vector3(-5,-10, 0)); camera.attachControl(canvas, false) return scene; };
  3. i'm using babylon.js and oimo.js to build a simple scene which has boxes on top of another, there's 7 boxes, and after the scene was build the boxes starts moving and fall, i didn't apply any force and the gravity i'm sure is ok, anyone know what's the reason causing this? and how to stop the moving thanks very very much!