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

Problems with InstancedMesh after phy.remove #26

Open
fatbatman opened this issue Jan 26, 2024 · 8 comments
Open

Problems with InstancedMesh after phy.remove #26

fatbatman opened this issue Jan 26, 2024 · 8 comments

Comments

@fatbatman
Copy link

fatbatman commented Jan 26, 2024

Create some objects that make use of InstancedMesh

        let test = []
        for(let i=0; i < 100; i++) { 
            test.push(phy.add( { type: 'cylinder', size:[1,1], instance:'someObj', mesh:aMesh, pos:[0,i,0]} ))
        }

Then remove some.

        setTimeout( () => {
            for(let i=0; i < 100; i+=2) { 
                phy.remove(test[i].name)
            }            
        }, 2000)

The mesh of the removed objects remains in view.

I've also seen an issue where the remaining instances then flicker in and out of view.

@lo-th
Copy link
Owner

lo-th commented Mar 30, 2024

i will look but i+=2 seems wrong ?

@fatbatman
Copy link
Author

It's meant to illustrate there is an issue if you remove some of them, not just the first or last added.

@lo-th
Copy link
Owner

lo-th commented Apr 1, 2024

i see yes, i have to find better method without id
because normally three instance is not made for add and remove instance

@lo-th
Copy link
Owner

lo-th commented Apr 3, 2024

ok remove on instance should be fixed.

@lo-th lo-th closed this as completed Apr 7, 2024
@fatbatman
Copy link
Author

fatbatman commented Apr 9, 2024

I'm still seeing problems when I use instance.
I end up with lots of meshes floating in the scene that are no longer being moved by physics.
Other that flash in and out of visibility.
I see this with Havok and Physx.

@lo-th lo-th reopened this Apr 9, 2024
@lo-th
Copy link
Owner

lo-th commented Apr 9, 2024

do you readd object on same instrance ?
is maybe a problem of name

@fatbatman
Copy link
Author

I see that's the problem, I wasn't giving them a name.
If I give them a unique name it works fine.

The only reason I'd say this is still a bug is because it works correctly when instance is not specified.

@fatbatman
Copy link
Author

I've just noticed that if I also add other objects that have a different mesh and are not using an instance, these flicker and disappear / swap places.

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