i have a button and when i click it i want a new mesh to appear
new mesh comes, but old mesh does not disappear
but if i reload the scene it doesn’t come on new mesh
but refreshing the page gives me negative value in terms of performance
For this reason, I need to delete the imported mesh and import the new mesh in the same scene.
setEnabled(false) - disables the mesh so it doesn’t interact with the scene at all
isVisible = false - hides the mesh but interacts with the scene, so it receives events, it interacts with the phsyics engine. It can be also used in case you don’t want to hide it’s children
I know I know
I will try but I don’t believe myself
I just wanted to delete the last mesh I uploaded with a different parameter instead of the importmesh parameter, but I guess I can’t.
like this
ı add new mesh
but the new mesh overlaps the old mesh
I do not want to this
1st should be deleted automatically when 2nd is added
Thanks for your help
Actually my problem is not solved
There are two reasons for this, the first is my bad english
second, i’m doing this in a big project with too many components
In short, the place where I imported the mesh and the place I used to add a new one are in separate places.
and it keeps telling me dispose() is not a function
and it’s make me crazy
My guess here is you are trying to save the first mesh to variable so you can access it later. If you add something like: let myFirstMesh outside the loading block. Then inside the loading of your first mesh, put myFirstMesh = meshes[0]
Now you can access myFirstMesh.dispose() outside that loading function.