Dad72 Posted November 25, 2015 Share Posted November 25, 2015 Hi, I load scene serialized with a cube using BABYLON.SceneLoader.Load () the scene is load, but if I move the mouse cursor, I error: Active camera not set.but yet I have an active camera as you can see in this scene. See the console for error: http://www.castorengine.com/public/demo/Teste/index.php Thanks gryff 1 Quote Link to comment Share on other sites More sharing options...
gryff Posted November 25, 2015 Share Posted November 25, 2015 Was going to post the same thing today Dad. Seems to be with BJS 2.3. Same code I am using works quite happily with BJS 2.2 and it includes the BABYLON.SceneLoader.Load () coding And despite the error message the camera does see to be active. The exact message I get with FF which may be helpful: Error: Active camera not set babylon.2.3.js:9:16353 And with the FreeCamera, which is active as I can move around quite easily, the number of the same error messages climbs when moving the mouse cursor - but not the arrow keys. cheers, gryff Edited to add some extra info from my experiences. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted November 25, 2015 Author Share Posted November 25, 2015 the error here, but I do not really know why this error produce : Scene.prototype.createPickingRayInCameraSpace = function (x, y, camera) { var engine = this._engine; if (!camera) { if (!this.activeCamera) throw new Error("Active camera not set"); camera = this.activeCamera; } var cameraViewport = camera.viewport; var viewport = cameraViewport.toGlobal(engine); var identity = BABYLON.Matrix.Identity(); // Moving coordinates to local viewport world x = x / this._engine.getHardwareScalingLevel() - viewport.x; y = y / this._engine.getHardwareScalingLevel() - (this._engine.getRenderHeight() - viewport.y - viewport.height); return BABYLON.Ray.CreateNew(x, y, viewport.width, viewport.height, identity, identity, camera.getProjectionMatrix()); }; Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 25, 2015 Share Posted November 25, 2015 This is because you have two scenes:var createScene = function () { scene = new BABYLON.Scene(engine); BABYLON.SceneLoader.Load("", "http://www.castorengine.com/public/demo/Teste/game_castor.babylon", engine, function (newScene) { scene = newScene; the first scene (scene=new BABYLON.Engine(engine)) is created but never used. But still referenced by engine. Just remove it. On my side will fix this to prevent the error Quote Link to comment Share on other sites More sharing options...
Dad72 Posted November 25, 2015 Author Share Posted November 25, 2015 Oh yes, is ok, yet even before that worked like that. I thought that the second scene overwrite the first scene. Thank you Deltakosh 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.