Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about Implementation #1

Closed
Rechi86 opened this issue Jun 26, 2019 · 3 comments
Closed

Question about Implementation #1

Rechi86 opened this issue Jun 26, 2019 · 3 comments

Comments

@Rechi86
Copy link

Rechi86 commented Jun 26, 2019

First of all thank, you for sharing this implementation. Coming from Unity this is a very good example of implementing a similar base structure within BJS.
I hope It is ok to ask a question using the issue section.

Within your Game.js: startRenderLoop-Method (line 194), you have a 50ms timeout set.

    startRenderLoop() {
        setTimeout(() => {
            this.engine.runRenderLoop(() => {
                this.currentLevel.scene.render();
            });
        }, 50);
    }

I'm not sure why this is needed, but in my own implementation adding a similar timeout solved the Error of "Active camera not set" when disposing the old scene after loading a new one. Is this also the reason you need this timeout? Do you know why this may be needed before disposing the old scene?

@TiagoSilvaPereira
Copy link
Owner

Hi @Rechi86 this timeout is not necessary... I was trying to debug an error and I forgot to remove It... Thank you by notice It, I will remove in a previous commit.

@TiagoSilvaPereira
Copy link
Owner

The "active camera not set" can happen when you don't have an active camera on your scene:

scene.activeCamera = camera;

It is necessary in some places of the application.

@TiagoSilvaPereira
Copy link
Owner

I think the current code I'm using to dispose the scene can help you too: https://github.com/TiagoSilvaPereira/simple-3d-fps/blob/master/src/base/Level.js#L68

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants