brianzinn

Members
  • Content count

    244
  • Joined

  • Last visited

  • Days Won

    2

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. https://doc.babylonjs.com/how_to/debug_layer 2. Spector.js even more low level down to WebGL (https://spector.babylonjs.com/)
  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 (https://babeljs.io/), 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 "this.box" variable from another JS file - from the instance of the Box class. https://www.babylonjs-playground.com/#WQ8M9K#1
  4. hi. there's a working version here: http://www.babylonjs.com/demos/gui/ 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 (https://github.com/BabylonJS/Babylon.js/blob/9824853960fc2a4be97b1acb6907244c8df9f05e/src/Cameras/babylon.camera.ts#L553)
  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: http://www.babylonjs-playground.com/indexstable#M5Z1R9#2 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): https://doc.babylonjs.com/classes/3.1/abstractmesh#computeworldmatrix-force-rarr-matrix-classes-3-1-matrix- 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 (https://github.com/BabylonJS/Babylon.js/blob/master/src/Layer/babylon.highlightlayer.ts#L812). 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. http://www.babylonjs-playground.com/indexstable#WG9OY#15 ** 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: http://viewer.babylonjs.com/domexample http://viewer.babylonjs.com/eventsexample
  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 (http://www.html5gamedevs.com/topic/33478-highlighter-not-working-in-vr/). 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 (http://www.babylonjs-playground.com/#E0WY4U#18). 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 (http://www.html5gamedevs.com/topic/33942-threejs-or-babylonjs-for-room-design/?do=findComment&comment=194879). 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