Jump to content

problem with the camera


Recommended Posts



it happens to me a strange thing. my editor is composed of several tab and in I'm on the ground tab and I charge the ground, my camera moves correctly with the keyboard. But if I change tab and I returned to the ground tab, the camera won't move with the keyboard.


Have you any ideas of what could be the cause of this behavior ?


Thank you

Link to comment
Share on other sites

when I click on the "ground" tab remains active tab and deactivate the handling of the camera (with the keyboard). I'm forced to click in an empty space (any div) so that the camera can be handle.

If I click in the canvas with a loaded scene, it does not give focus to the page. the tab remains active .


Do you have ideas to solve this ?

Link to comment
Share on other sites

I have try this kind of thing.I think it's because each tab I have an iframe and when I select a tab that is on the index, I have to click on an element of the iframe to get the focus, but if I click on on the canvas with a loaded scene, it does not work. The camera won't move with the keyboard, just with the mouse.


This is very strange. but I'll try to make a little example tomorrow.

Link to comment
Share on other sites

It was a choice I made there 1 year and 6 months. I can not go back in the current state of the project which is around 3000 files. it's not as if I was at the beginning of the project. and I had no choice.

I have 8 tabs, each tab, iframe, because each tab is a editor that needs its own css, its own scripts, its own php functions ...

If I had done without Iframe my project would unmanageable.

Link to comment
Share on other sites

Quick fix for you: replace window by window.parent in FreeCamera.prototype.attachControl for all calls to addEventListener. It works for me on chrome.


Sorry gwenael, I not understand what you would me propose to make

Link to comment
Share on other sites

ah, ok. There have not possibility to integrate it directly into Babylon by a function :


This could be useful for others. I do not use custom version of Babylon, just one official version.


If it pais you Deltakosh, you can add this fix





Link to comment
Share on other sites

I can not create a function apart. it is just 3 extra line of code that fixes this problem for me but may be for others in the future.
It remains a lack Babylon the specific uses. it mean that with babylon can not know the users specific application ?


Without adding new function, I simply proposes to amend the attachControl function for specific cases by adding signature "parent".

Please Deltakosh. This would help me and maybe others too. that would exist in babylon well.


Fonction complete :

        FreeCamera.prototype.attachControl = function (element, noPreventDefault, parent) {                        //----            //you code no modified            //----			            element.addEventListener("mousedown", this._onMouseDown, false);            element.addEventListener("mouseup", this._onMouseUp, false);            element.addEventListener("mouseout", this._onMouseOut, false);            element.addEventListener("mousemove", this._onMouseMove, false);	    if(parent) {		window.parent.addEventListener("keydown", this._onKeyDown, false);		window.parent.addEventListener("keyup", this._onKeyUp, false);		window.parent.addEventListener("blur", this._onLostFocus, false);	    } else {		window.addEventListener("keydown", this._onKeyDown, false);		window.addEventListener("keyup", this._onKeyUp, false);		window.addEventListener("blur", this._onLostFocus, false);	    }        };
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.

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.


  • Recently Browsing   0 members

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