Sign in to follow this  
Dad72

Error: Active camera not set

Recommended Posts

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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());        };

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.