freeEntity meshx

Blitz3D Forums/Blitz3D Beginners Area/freeEntity meshx

rickavzstx(Posted 2014) [#1]
hello, i have little problem, you can help me to resolve this ?

I have to Free one entity , I load one Mesh, avec another mesh to parent , when a want to free the second mesh , entity is not found , example :

x=loadmesh ("a.3ds")
y=loadmesh ("b.3ds",x) ; add to parent , i think !
freeEntity Y when a want to free is crash !!!!!!

Y is not found , but is displayed , and when a free entity X , Y is not free ! and always appears

have a idea ?


RemiD(Posted 2014) [#2]
Maybe you have reused "y" to store another value ? I suggest to use more descriptive variable names...

Try :
Graphics3D(800,600,32,2)

Camera = CreateCamera()

AMesh = LoadMesh("A.b3d") ;replace .b3d by .3ds
BMesh = LoadMesh("B.b3d") ;replace .b3d by .3ds
EntityParent(BMesh,AMesh,True)
FreeEntity(BMesh)
BMesh = 0

EndGraphics()

End()


On my computer this works.


RGR(Posted 2014) [#3]
You cannot free an entity which is still in use and wonder why it crashes.
Parenting is NOT AddMesh!
Its just building a certain connection which can always be changed and altered.
Both Meshes are still active and needed.

.


rickavzstx(Posted 2014) [#4]
ok,, i test this,, thank you


RemiD(Posted 2014) [#5]

You cannot free an entity which is still in use and wonder why it crashes.


What ?
Why would it be not possible to free an entity which exists/is still in use ? Is it not what the FreeEntity() function is all about ?


RGR(Posted 2014) [#6]
Hey, RemiD, what are you taking about?

You can misunderstand everything wrong if you want - but this does not change the sense of this thread!
Read what this thread is about and you will see that you talk about something you did not understand.

Of cause can you free any entity at every time you want ... but NOT if you want to still show it and if it is parented to another entity ...
Think first and then write!

He thought that parenting the mesh to another is ADDING it ... NO it is not added! And that's what the thread is about ... what you can theoretical do does not change that!


RemiD(Posted 2014) [#7]

I have to Free one entity , I load one Mesh, avec another mesh to parent , when a want to free the second mesh , entity is not found , example


Sorry but to me this means that he wants to set one mesh as a child of another mesh, not add a mesh to another mesh.

But maybe it is what he wants. I understand what you mean but not what you wrote. Whatever he now has 2 ways to do these 2 different things.


RGR(Posted 2014) [#8]
The important words are inside his code ... and if you critisize my answer you should read everything.

x=loadmesh ("a.3ds")
y=loadmesh ("b.3ds",x) ; add to parent , i think !
freeEntity Y when a want to free is crash !!!!!!


The code rick provided is just two lines of the program he writes.
He thinks that parenting means adding - but that's wrong - so he cannot free y since in his further code it will obviously be used in another way as he thinks and crashes the program ...
Additional there's FreeMesh and FreeEntity to consider ... but that's another thing.

RemiD, your code snippet misses one important thing: the loop with RenderWorld and Flip
If you just finish the program, before the engine is trying to display the mesh I will not crash ...


RemiD(Posted 2014) [#9]

RemiD, your code snippet misses one important thing: the loop with RenderWorld and Flip


I cannot guess what he has in his head or in his code so i have answered considering the infos i was given. Whatever! (I still don't see where you see AddMesh() or the intent to merge 2 meshes in his code...)