yfVivien Posted June 22, 2017 Share Posted June 22, 2017 Hey, First time playing around with Babylon, it is awesome!!! But drives me crazy too LOL. I am trying to apply collisions onto boxes. It works in playground, but when I copy and paste the code into my local project, it stopped working. playground: http://www.babylonjs-playground.com/#RNKEAZ local: scripts included: <script src="http://cdn.babylonjs.com/2-5/babylon.js"></script> <script type="text/javascript" src="scripts/cannon.js"></script> <script type="text/javascript" src="scripts/babylon.fireProceduralTexture.js"></script> code: function createScene(map) { scene = new BABYLON.Scene(engine); engine.enableOfflineSupport = false; fireTexture = new BABYLON.FireProceduralTexture("fire", 256, scene); flame = new BABYLON.Texture("Fire.png", scene); createSkybox(); createSun(); createGround(); // createBuildings(map); // createNPCMesh(); // createPlayerMesh(); createAvatar(); // create and attach camera var box0 = BABYLON.Mesh.CreateBox("box0", 1, scene); box0.position = new BABYLON.Vector3(10, 5, 5); var box1 = BABYLON.Mesh.CreateBox("box1", 3, scene); box1.position = new BABYLON.Vector3(-10, 5, 5); scene.collisionsEnabled = true; box0.checkCollision = true; box1.checkCollision = true; scene.registerBeforeRender(function() { box0.moveWithCollisions(new BABYLON.Vector3(-0.1, 0, 0)); }); return scene; } Any ideas? Thanks in advance Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 22, 2017 Share Posted June 22, 2017 What kind of error do you get? (And the code you copy / paste is fairly different from the one in the PG :)) Quote Link to comment Share on other sites More sharing options...
yfVivien Posted June 22, 2017 Author Share Posted June 22, 2017 I did not get an error, the box just passes through the other one. BUUUUUT, I figured out why tho, the code is indeed different. It should be .checkCollisions instead of .checkCollision stupid me ;( GameMonetize and aWeirdo 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.