• Content count

  • Joined

  • Last visited

  • Days Won


brianzinn last won the day on October 12

brianzinn had the most liked content!

About brianzinn

  • Rank
    Advanced Member

Recent Profile Visitors

649 profile views
  1. How to inspect when variables are local?

    There's nothing preventing you from using global variables, although it is arguably a better practice to encapsulate variables - javascript hoisting can be a hard thing to find/fix. If you need to inspect local variables you can break in the code by placing a breakpoint in the developer tools or reference from a global variable and composition. BabylonJS team has also provided two very useful tools: 1. The Inspector itself is very useful for seeing what is going on. 2. Spector.js even more low level down to WebGL (
  2. @Alenvei - Yes, so you could do this in the other JS file, which needs access to the box instance: var sphereAndSquareIntesect = this.sphere.intersectsMesh(box.mesh) The syntax from spankied looks better, but make sure ES2015 is okay for you, if you need to support older browsers; if you are not using something like babel (, otherwise the syntax from senglean is more compatible with older browsers.
  3. Since it's in another JS file then you can't use "this" from the other file. I have expanded a bit on the PG from Spankied. Look at the mesh() "property", that's one way to get access to a "" variable from another JS file - from the instance of the Box class.
  4. hi. there's a working version here: Are you loading (order of scripts in the html page) babylon.gui.js after babylon.js?
  5. @Wingnut I think stable is OK, but anything on latest was not working and also the playground kept switching to latest! I thought momentarily I was at a Pink Floyd concert or something - maybe just an acid flashback. sorry for the upset stomach!
  6. Thanks for the correction @aWeirdo, Ray is Number.MAX_VALUE. It's camera.getForwardRay() that is limited to 100 by default (
  7. Mesh Intersect Timing

    There's a sticky topic called "marking questions as solved".
  8. good question. I tried your PG with a couple of changes to see if it would make a difference, but it didn't: It works till distance 3350000 and not at 3360000, although not very accurate at that distance. I have noticed this before with BABYLON.Ray(), which defaults to 100. I wonder if it is some optimisation, but I can't find it.
  9. Mesh Intersect Timing

    I think if you use mesh.computeWorldMatrix(true) that it will update the actual position (otherwise a cached position is used): There are ways to force a render, but that's an expensive operation...
  10. The thing about removing meshes is that the unique ID of the mesh is used internally for removing a mesh from a highlight layer ( So, you will need to remember what is highlighted. I made a PG where the mesh is deselected when you click on a new one. In the PG if it's not a sphere you could just deselect. ** Right now the playground is not working for me for even basic scenes on 'latest', so just click on the "version" dropdown and click stable.
  11. The new Babylon Viewer

    When deltakosh showed the viewer in his talk today - I was like "how did I not know about this?" So, it's NEW! The other html files in the /dist/ folder are available, too. ie:
  12. OBJ file loads without material

    In the blender exporter you can specify no materials, so would suggest look at export options. Compare .OBJ files with and without exported textures. If the material is specified look for 404s and reload browser cache.
  13. What's next?

    Yes, I can do a PR for that and more. I feel better doing a PR with actual hardware, so let me first buy a proper headset on Thursday when I'm downtown Vancouver to listen to your talk .
  14. What's next?

    @Deltakosh - My first weird experience came here ( But to answer your question - I have my game using a combination of code from VRExperienceHelper and the excellent 'zero to hero' PG from davrous ( In the PG to cast a ray: if (!camera.leftController) { ray = camera.getForwardRay(); } else { ray = camera.leftController.getForwardRay(); } In the PG to create a VR camera: if (navigator.getVRDisplays) { camera = new BABYLON.WebVRFreeCamera("WebVRCamera", new BABYLON.Vector3(0, 2, 0), scene); scene.gamepadManager.onGamepadConnectedObservable.add((pad) => onNewGamepadConnected(pad)); camera.onControllersAttachedObservable.add(() => onControllersAttached()); } else { camera = new BABYLON.VRDeviceOrientationFreeCamera("WebVRCamera", new BABYLON.Vector3(0, 2, 0), scene); } Like how you gracefully degrade to webgl1 if webgl2 context isn't available - so maybe camera.getForwardRay() could check for camera.leftController and use that, if available. Or WebVRFreeCamera would downgrade to VRDeviceOrientation. I am imagining how this could be easier for somebody that doesn't have both kinds of devices to test with to make these VR scenarios easier. Something like a VRUniversalCamera that maybe auto-connects controllers? The VRExperienceHelper has encapsulated a lot of the logic to help me understand how to accommodate a proper VR controller, which I don't have - which is great (to have this helper)! I am trying to build for Cardboard and GearVR, so using a gaze approach. I am probably doing it wrong, but I am listening for full screen to exit to detect when camera should change back (assuming we only want VR in full screen). Is checking currentVRCamera instanceof the way to detect if controller is in use - nothing else is public? I want to wire up code once VR is entered, but onEnteringVR is too early, so ideally I would like an onEnteredVR with maybe extra info like 'this._webVRready'). I sometimes have issues when I change the device orientation that the VR button is off screen and the canvas is not switching from portrait to landscape. I *do* realise this is an open source project and I can contribute. I am more waiting to see what comes out of 3.1 as those recently assigned will probably fix many of these and then to contribute from my own experiences, if anything is missing. So, my request for 3.2 was to make it easier to target VR.
  15. What's next?

    There is an interesting comment recently from max123 regarding cameras ( I find myself doing awkward checks on cameras especially in VR. I don't know if unifying the cameras even more is something worth considering. I like the work you did adding behaviours recently - perhaps that is one way to go. It is already done a lot like behaviours the way inputs are dynamic. Also, AR.js as a supported plugin