Jump to content

Loading 2 BabylonJS files - minor conflict


Mpman
 Share

Recommended Posts

Hi all,

I loaded 2 JS files into a web application (2 different zones and roles), both work great, the issue comes when i use the first JS file area, the camera is not dragging on screen once i call the second JS, almost as if the second JS killed the first JS camera functionality.

Is there a way to Reload events in Babylon? so when i access the first JS a function can reload the camera?

Both use the same camera but different camera name/vars.

I do not wish to load multiple models, but multiple Babylon JS files.

 

Thanks!

Link to comment
Share on other sites

Hi thanks for responding!

I simply loaded 2 JS files into 2 separate divs in the same application.

They see each other and there are no conflicts other than when i load the second JS, the first one's camera is not functioning (you drag the mouse and nothing happens).

If i reload the first div it works but is slower than before. i suspect that there is a way to reload the camera part (which i tried), or use code that avoids the issue.

I also removed the div that holds the second JS and went back to the first div and the issue remained almost as if the initiation of the second JS changed the first one forever (upon initiation).

Each JS does use "BABYLON.SceneLoader.ImportMesh" and by renaming similar vars i.e. camera --> camera2 i managed to avoid any other conflicts.

 

Link to comment
Share on other sites

ISSUE RESOLVED :))

On the second JS i used scene in the main code and a new var for the createScene part (scene2)...

I also removed the babylon.js lib call from the second JS.

 

FIRST JS

var scene = createScene();

engine.runRenderLoop(function () {
            scene.render();
        });

 

SECOND JS

var scene2 = createScene();

engine.runRenderLoop(function () {
            scene2.render();
        });

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...