• Content count

  • Joined

  • Last visited

  1. ES6 Module issues

    Ah, of course I wasn't actually importing oimo like I was cannon! However, if I do: import './node_modules/babylonjs/dist/preview release/oimo.js' I get: oimo.js:4 Uncaught TypeError: Cannot read property 'OIMO' of undefined at oimo.js:4 at oimo.js:5
  2. ES6 Module issues

    I'm using master and whatever is in the 'preview release' folder. Should I be building locally? Live reload enabled. es6.js:10915 Babylon.js engine (v3.2.0-beta.1) launched main.js:14 ƒ OimoJSPlugin(iterations) { = "OimoJSPlugin"; this._tmpImpostorsArray = []; this._tmpPositionVector = BABYLON.Vector3.Zero(); this.BJSOIMO = t… main.js:15 Uncaught ReferenceError: OIMO is not defined at HTMLDocument.document.addEventListener (main.js:15)
  3. ES6 Module issues

    Hit another one so thought I'd just make a single thread! Uncaught TypeError: Cannot read property 'World' of undefined at new OimoJSPlugin (es6.js:79131) at HTMLDocument.document.addEventListener (main.js:15) Let me know if you need any more info.
  4. Thanks Raanan. A bit more info. I can also shoot meshes into instances and have them affected. Just not RadialExplosionImpulse or RadialExplosionForce.
  5. Another possible ES6 issue with cloning

    Nice One! However, I'm still seeing the issue in the latest pull (unless yarn (me) is being stupid). Yeah ESLint supports ES6 Modules. Standard is a good preset ( and there is alway Semi-standard if you really insist on semicolons! UPDATE: This could be because I'm using the preview release builds from the repo. Not sure if these are updated every merge.
  6. <!DOCTYPE html> <html xmlns=""> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Babylon Template</title> <style> html, body { overflow: hidden; width: 100%; height: 100%; margin: 0; padding: 0; } #renderCanvas { width: 100%; height: 100%; touch-action: none; } </style> <script src=""></script> </head> <body> <canvas id="renderCanvas" touch-action="none"></canvas> //touch-action="none" for best results from PEP <script type=module> import * as BABYLON from './node_modules/babylonjs/dist/preview release/es6.js' var canvas = document.getElementById("renderCanvas"); // Get the canvas element var engine = new BABYLON.Engine(canvas, true); // Generate the BABYLON 3D engine /******* Add the create scene function ******/ var createScene = function () { var scene = new BABYLON.Scene(engine); scene.clearColor = new BABYLON.Color3(.5, .5, .5); var camera = new BABYLON.ArcRotateCamera("camera1", 0, 0, 0, new BABYLON.Vector3(5, 3, 0), scene); camera.setPosition(new BABYLON.Vector3(10.253, 5.82251, -9.45717)); camera.attachControl(canvas, true); var light = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(1, 0.5, 0), scene); light.intensity = 0.8; var blueMat = new BABYLON.StandardMaterial("blue", scene); blueMat.emissiveColor = new BABYLON.Color3(0, 0, 1); var redMat = new BABYLON.StandardMaterial("red", scene); redMat.emissiveColor = new BABYLON.Color3(1, 0, 0); var body = BABYLON.MeshBuilder.CreateCylinder("body", { height: 0.75, diameterTop: 0.2, diameterBottom: 0.5, tessellation: 6, subdivisions: 1 }, scene); var arm = BABYLON.MeshBuilder.CreateBox("arm", { height: 0.75, width: 0.3, depth: 0.1875 }, scene); arm.position.x = 0.125; var blueBlock = BABYLON.Mesh.MergeMeshes([body, arm], true); blueBlock.position = new BABYLON.Vector3(1, 3, 4); blueBlock.material = blueMat; redBlock = blueBlock.clone("redBlock"); redBlock.material = redMat; redBlock.position = new BABYLON.Vector3(4, 3, 4); return scene; }; /******* End of the create scene function ******/ var scene = createScene(); //Call the createScene function engine.runRenderLoop(function () { // Register a render loop to repeatedly render the scene scene.render(); }); window.addEventListener("resize", function () { // Watch for browser/canvas resize events engine.resize(); }); </script> </body> </html> Causes: Uncaught TypeError: Cannot set property hasLODLevels of [object Object] which has only a getter at Function.Tools.DeepCopy (es6.js:8437) at new Mesh (es6.js:27563) at Mesh.clone (es6.js:29032) at createScene (play.html:68) at play.html:77 Same code with a script src tag works fine.
  7. The PG is based on the PhysicsEngine HowTo example but modified to use instances. It seems to work with the gravitationalField but not applyRadialExplosionImpulse. Is there something I've missed or is this not possible right now?
  8. Low FPS

    Thanks for the welcome, John And thanks very much for the responses. Yeah, those are some big numbers! Good to know others are seeing similar performance. I'm still experimenting with BJS and trying to get a sense of what could be achieved and what the limits are.
  9. Learning Babylon.js - The ebook!

    Hi there, is this book still relevant for the recent versions of BabylonJS?
  10. Low FPS

    The playground from runs at 10fps on my Razor Blade laptop with nVidia GTX 1060. Is that normal?
  11. <!DOCTYPE html> <html> <head> <script src='./node_modules/babylonjs/dist/preview release/babylon.js'></script> <script src='./node_modules/babylonjs/dist/preview release/cannon.js'></script> <script> document.addEventListener('DOMContentLoaded', () => { const canvas = document.getElementById('renderCanvas') const engine = new BABYLON.Engine(canvas) const scene = new BABYLON.Scene(engine) scene.enablePhysics() const physicsHelper = new BABYLON.PhysicsHelper(scene) const camera = new BABYLON.ArcRotateCamera('camera', 1, 20, 10, new BABYLON.Vector3(20, 0, 0)) camera.setPosition(new BABYLON.Vector3(0, 20, -30)) scene.activeCamera.attachControl(canvas) const sun = new BABYLON.HemisphericLight('', new BABYLON.Vector3(0, 1, 0)) sun.diffuse = new BABYLON.Color3(0.8, 0.8, 0.8) sun.groundColor = new BABYLON.Color3(0.1, 0.1, 0.1) const box = BABYLON.MeshBuilder.CreateBox('active', { size: 0.9 }) const boxMaterial = new BABYLON.StandardMaterial('') boxMaterial.diffuseColor = new BABYLON.Color3(0.5, 0.5, 1) box.material = boxMaterial box.physicsImposter = new BABYLON.PhysicsImpostor(box, BABYLON.PhysicsImpostor.BoxImposter, { mass: 1, restitution: 0.9, friction: 1 }) }) </script> </head> <body> <canvas id='renderCanvas'></canvas> </body> </html> Any ideas why this code gives the following error? cannon.js:5756 Uncaught TypeError: Cannot read property 'calculateWorldAABB' of undefined at Body.computeAABB (cannon.js:5756) at Body.updateMassProperties (cannon.js:5930) at Body.addShape (cannon.js:5693) at t.generatePhysicsBody (babylon.js:43) at t.addImpostor (babylon.js:43) at t._init (babylon.js:43) at new t (babylon.js:43) at HTMLDocument.document.addEventListener ((index):32) I'm using the latest GitHub code `Babylon.js engine (v3.2.0-alphaC) launched`
  12. Just installed from master and that appears to be all working for me now. Thanks!
  13. I'm having trouble using `createInstance` when importing BabylonJS as an ES6 module. // <script src='main.js' type='module'></script> import {Engine, Scene, ArcRotateCamera, Vector3, MeshBuilder, Color3, HemisphericLight} from './node_modules/babylonjs/es6.js' document.addEventListener('DOMContentLoaded', () => { const canvas = document.getElementById('renderCanvas') const engine = new Engine(canvas, true) const scene = new Scene(engine) const camera = new ArcRotateCamera('camera', 1, 0.8, 10, new Vector3(0, 0, 0)) camera.setPosition(new Vector3(0, 0, -100)) scene.activeCamera.attachControl(canvas) const light = new HemisphericLight('', new Vector3(0, 1, 0)) light.diffuse = new Color3(1, 1, 1) light.groundColor = new Color3(0.2, 0.2, 0.2) let mesh = MeshBuilder.CreateSphere('', {}) mesh.createInstance('') }) If I run the previous code I get the following error: TypeError: Cannot set property renderingGroupId of [object Object] which has only a getter es6.js:17243 at InstancedMesh.AbstractMesh [as constructor] (c:\Users\phil\code\sandbox\babylonjs-test\node_modules\babylonjs\es6.js:17243:37) at new InstancedMesh (c:\Users\phil\code\sandbox\babylonjs-test\node_modules\babylonjs\es6.js:55221:33) at Mesh.createInstance (c:\Users\phil\code\sandbox\babylonjs-test\node_modules\babylonjs\es6.js:29095:21) at HTMLDocument.document.addEventListener (c:\Users\phil\code\sandbox\babylonjs-test\main.js:19:9) Importing the library in a script tag works fine: // <script src=""></script> // <script src='main.js'></script> document.addEventListener('DOMContentLoaded', () => { const canvas = document.getElementById('renderCanvas') const engine = new BABYLON.Engine(canvas, true) const scene = new BABYLON.Scene(engine) const camera = new BABYLON.ArcRotateCamera('camera', 1, 0.8, 10, new BABYLON.Vector3(0, 0, 0)) camera.setPosition(new BABYLON.Vector3(0, 0, -100)) scene.activeCamera.attachControl(canvas) const light = new BABYLON.HemisphericLight('', new BABYLON.Vector3(0, 1, 0)) light.diffuse = new BABYLON.Color3(1, 1, 1) light.groundColor = new BABYLON.Color3(0.2, 0.2, 0.2) let mesh = BABYLON.MeshBuilder.CreateSphere('', {}) mesh.createInstance('') }) I'd like to avoid bundlers and transpilers while developing the code and just package it up later on.