Jump to content

Switching scenes: Camera rotate issue?


FlashyGoblin
 Share

Recommended Posts

So when switching back and forth between multiple scenes, the camera does an unexpected thing. Each scene has it's own camera, if I update the rotation of one camera, and then switch to a new scene, the new scene's camera animates to the rotation of the previous scene.

Here is a Playground link. When the first scene loads, rotate the camera a bit. Then switch to the other scene by clicking on the fps counter in the top right of the screen. The new scene's camera rotations to the position of the previous scene's camera. 

http://www.babylonjs-playground.com/#1B3R9A#21

This only happens with the rotation, the position is fine.

 

Any thoughts?

Link to comment
Share on other sites

Could it be something to do with how windows deals differently with the keyboard input buffer and the mouse input buffer? For position one press of a key does one movement and buffer emptied (?). For rotation mouse movement is to do with change in mouse position and buffer retained (?). Not sure I really know what I am talking about. This may help (or not) https://msdn.microsoft.com/en-us/library/windows/desktop/ms682079%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396

Link to comment
Share on other sites

Hi Goblin,

As JC said - detach and attach are the secret - http://www.babylonjs-playground.com/#7L1BY

And (Playground only!) - you will need to remove the default render loop the playground is adding (I am hacking it in your register render loop function. This is not the BEST solution, but it works :) )

Also pay attention that registering a click event listener in the palyground must be unregistered, otherwise it will register again and again with every press of run.

Hope that helps!

Link to comment
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...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...