• Content Count

  • Joined

  • Last visited

About tbgeorge

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. That works until the timeout hits, then the camera just snaps to where it wants to be. I need to be able to get this functionality: psuedocode: DeviceCam.setTarget( Vec3( 0, 1, 0 ) ); and have the camera look in that direction as soon as the app starts up and any movements after that are all based off of that direction. With setTimeout, the camera is looking in that direction until the timeout is done, then it snaps to where the device orientation thinks it's looking. Basically, I need to be able to set the initial direction for the DeviceOrientationCamera and not have the input manager change it to something drastically different as soon as I attach control. I have this scene: http://client.elementxcreative.com/bjs/DeviceOrientation/index.html I have exported it from unity with the camera facing the set of 4 cubes, though when you load the game in various different phone orientations it's looking at various different sets of cubes. ( FYI, there are 4 sets of cubes: 1 cube, 2 cubes, 3 cubes, and 4 cubes ). I need it to always look at the 4 boxes when I load the scene, no matter my orientation.
  2. Hello, I'm trying to use a Device Orientation Camera for a game. I want it to be looking in a specific direction in the game every time you start the game, regardless of your real world rotation. But whenever I start the game, the camera immediately rotates to where I'm looking in the real world instead of starting up looking in my starting direction. I know this must be pretty confusing, but hopefully someone can understand it and help me out. Thanks
  3. Hey, I'm working with video textures and I just noticed that they continue reloading themselves whenever they finish so they can loop. Is this a bug/is there a way to fix this? I was using this playground link and got the results in the attached image: http://www.babylonjs-playground.com/#CHQ4T#1 -Thanks
  4. Hi, so I have this scene and I've tried to hack together a way to change the angle of each particle though there is still one frame occasionally that it shows up at angle = 0. Here's a link to my playground scene: http://www.babylonjs-playground.com/#1PO0WU#10 Would it be possible to set a starting angle for particles to come out of the emitter at? Such as: particleSystem.startingAngle = #; Thanks
  5. Hey I'm trying to get the light intensity in unity to export with my scene. I tried to add _darkness as an exported variable but the SceneLoader doesn't seem to load it in. -Thanks
  6. ******* EDIT ******* This isn't happening in the nightly build, though the mesh does not show up anymore if I freeze the material Hey, I'm trying to freeze most of the materials in my scene that shouldn't change right at the beginning of the app. This error happens when I freeze the material used by an instanced mesh. I can freeze all other materials just fine. As soon as the instanced mesh comes into view of the camera I get this error: Uncaught TypeError: Cannot read property 'index' of undefined -- babylon.max.nightly.js:6297 Engine.updateAndBindInstancesBuffer @ babylon.max.nightly.js:6297 Mesh._renderWithInstances @ babylon.max.nightly.js:17952 Mesh._processRendering @ babylon.max.nightly.js:17960 Mesh.render @ babylon.max.nightly.js:18027 SubMesh.render @ babylon.max.nightly.js:19514 RenderingGroup.render @ babylon.max.nightly.js:14289 RenderingManager.render @ babylon.max.nightly.js:14221 Scene._renderForCamera @ babylon.max.nightly.js:15991 Scene._processSubCameras @ babylon.max.nightly.js:16033 Scene.render @ babylon.max.nightly.js:16186 (anonymous function) @ main.js:76 Engine._renderLoop @ babylon.max.nightly.js:5995Is it possible to freeze a material used by an instanced mesh? -Thanks
  7. Well, that shouldn't be the issue here, unless I'm understanding you incorrectly, because if you look at line 59-65, I'm assigning the loaded meshes the same material I assigned to the Babylon created planes ( which is casting shadows correctly ). What I'm confused about is how they are using the exact same material, though their shadows are still different.
  8. Hi, I'm trying to load a scene that has meshes with transparent textures on them (leaves). Though when I have those meshes cast shadows, it ignores the transparency and the shadow is incorrect. But when I do it with code, it seems to work as intended. Here is a link to my babylon playground: http://www.babylonjs-playground.com/#1JA4FW#5 Also, I was having a weird issue with the texture even causing shadows to cast at all, my solution was to put a single black pixel in the upper left and lower left corners of the texture and this caused shadows to show up. Any help is appreciated. Thanks
  9. I've figured it out. I had this code in the scene.executeWhenReady function and for some reason that was causing problems: scene.materials.forEach( function( mat ) { mat.freeze(); }); I moved it to a render loop that stops itself and it now works fine. Inside scene.executeWhenReady() : engine.runRenderLoop( freezeMaterials ); The 'freezeMaterials' function: function freezeMaterials() { scene.materials.forEach( function( mat ) { mat.freeze(); }); scene.getEngine().stopRenderLoop(freezeMaterials); }
  10. Hi, I'm trying to get the prefab instances to export correctly, and when they export, the .babylon file seems correct though if I have a material on the prefab at all (even the default material) I get an error when loading the scene. This is the error: "Uncaught TypeError: Cannot read property 'index' of undefined babylon.max.nightly.js:6297" Which leads to this section of code: Engine.prototype.updateAndBindInstancesBuffer = function (instancesBuffer, data, offsetLocations) { this._gl.bindBuffer(this._gl.ARRAY_BUFFER, instancesBuffer); if (data) { this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, data); } if (offsetLocations[0].index !== undefined) { // this is the line in question var stride = 0; for (var i = 0; i < offsetLocations.length; i++) { var ai = offsetLocations[i]; stride += ai.attributeSize * 4; } for (var i = 0; i < offsetLocations.length; i++) { var ai = offsetLocations[i]; this._gl.enableVertexAttribArray(ai.index); this._gl.vertexAttribPointer(ai.index, ai.attributeSize, ai.attribyteType || this._gl.FLOAT, ai.normalized || false, stride, ai.offset); this._caps.instancedArrays.vertexAttribDivisorANGLE(ai.index, 1); } } else { for (var index = 0; index < 4; index++) { var offsetLocation = offsetLocations[index]; this._gl.enableVertexAttribArray(offsetLocation); this._gl.vertexAttribPointer(offsetLocation, 4, this._gl.FLOAT, false, 64, index * 16); this._caps.instancedArrays.vertexAttribDivisorANGLE(offsetLocation, 1); } } }; This is not the current nightly build, but it is fairly recent, probably a week or two old. Any ideas? I can post more info/code if needed.
  11. Hey all, I'm trying to get the rotation of a DeviceOrientationCamera in the same way I get it from a FreeCamera by saying var camera = new BABYLON.FreeCamera("freeCam", BABYLON.Vector3.Zero(), scene); // var camera = new BABYLON.DeviceOrientationCamera("deviceCam", BABYLON.Vector3.Zero(), scene); var rot = camera.rotation; but this doesn't work. If I move the FreeCamera around with my mouse, the rotation is updated and constantly changing while I'm moving the mouse, but the DeviceOrientationCamera doesn't update the rotation variable when I view it on my cell phone. Is there a different way to get the camera's rotation that I'm missing?
  12. Ok great, glad it's not just me. I ended up just using an event listener for 'mousemove' and adding up rotations and applying them on update.
  13. BUMP... I've been trying stuff for hours and have gotten nowhere. engine.switchFullscreen(true) ... does nothing engine.isPointerLock = true ... does nothing I can only get the camera to react to the mouse movement without having to left click if I say attachControl(canvas) when the pointer lock is disabled. Obviously this is not the functionality I need. I've looked at several tutorials that do it such as this: http://p215008.mittwaldserver.info/Maze/ But as far as I can tell, I'm doing nothing different when it comes to controls/camera. I did try to manually adjust the camera rotation via an event listener on "mousemove" which worked when the pointer was locked, but it isn't as smooth as the built-in camera controls and also causes some issues with my HUD. Any help is greatly appreciated.
  14. Hello all, I'm trying to get a basic fps camera into my scene, but nothing I do to enable control when the pointer is locked seems to work. I can get the pointer to lock no problem, but when it is locked and hidden, it doesn't rotate the camera, but after I lock it and unlock it once, it moves the camera when it is not locked. Does anyone have any suggestions on this? I'm using the standard Pointer Lock API and using the camera.attachControl(canvas) and camera.detachControl(canvas) function calls. The problem is illustrated here http://www.babylonjs-playground.com/#219IXL#0 After locking and unlocking the pointer once, the camera will follow the mouse without having to click. I need this to happen when the pointer IS locked.
  15. http://www.babylonjs-playground.com/#IJA1L#1 UPDATE: Still working on getting rotation of the plane, but I think I got positioning down.