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

Don't hide a node if its children are still loading #8

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ErikSom
Copy link
Contributor

@ErikSom ErikSom commented Sep 30, 2024

In the following video you can see the tiles being removed before its children are loaded. I have exaggerated the issue by introducing an additional timeout in the tile renderer loader:

    const load = async (node) => {
        const uri = node.content.uri;
        console.log('LOADING: ' + uri);
        const url = `${this.apiUrl}${uri}?key=${apiKey}&session=${this.tileManager.session}`;

        /** @type {pc.Asset} */
        let asset;
        try {
            asset = await this.loadGlb(url);
        } catch (err) {
            console.error("An error occurred while loading the GLB:", err);
        }

        await new Promise(r => setTimeout(r, 5000));
earthatile-tile-popping-issue.mov

The problem; if a node contained GLB content but its children contained JSON, it would be removed after the JSON got loaded and not after the actual new child mesh is loaded.

I solve this by introducing a dependency, there could possibly be a better way to solve it, but for now this works for me.
Here you can see the fix in action:

earthatile-tile-popping-fix.mov

}

// Hide the expanded node's content
if (node.content && node.content.uri.includes('.glb')) {
// Hide the expanded node's content if there are no m
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment seems unfinished.

@willeastcott willeastcott self-assigned this Oct 1, 2024
@willeastcott willeastcott added the bug Something isn't working label Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants