how to undo AddMesh(a,b)

Blitz3D Forums/Blitz3D Beginners Area/how to undo AddMesh(a,b)

RGF(Posted 2008) [#1]
Is there any way to delete and added mesh "a", once it has been added to a parent entity "b"?

Thanks


Stevie G(Posted 2008) [#2]
Yes, one way would be to keep a copy of mesh b then simply delete the new mesh b ( with mesh a added ) and re-assign the mesh handle to be a copymesh of the original mesh b.

There are alternatives but can you explain what you need this for first?


RGF(Posted 2008) [#3]
I am triying to add a weapon, a shield, an armor, and some other freaky things to a main entity. Player could then de-select the sword and throw it away, or keep it in inventory, by using a 2d-interface similar to diablo inventory system, and add another kind of weapon instead. Main entity is animated (3000 frames), and has some particle systems linked to some specific vertex, so things wouldnt work as expected using entityparent. I`ve found some useful code here: "Attach Body Parts by Leon Drake" http://www.blitzbasic.com/codearcs/codearcs.php?code=1917
And my problem is solved with a few little modifications.....

Thank you very much, Stevie (and Leon)!!!!!!!!!!!!!!!


H. T. U.(Posted 2008) [#4]
LOL. That's the exact same method I use to attach body parts to my character and I never looked at the archives! They also have the added advantage in that you can move the parts with Blitz commands so you don't need a ton of different animations for simple functions.

Stevie, I didn't quite follow you, but could that be used for Blitz boolean operations? If so, I could have some VERY cool uses for that!


Ross C(Posted 2008) [#5]
Couldn't you just parent it, instead of adding?


RGF(Posted 2008) [#6]
Using entityparent(a,b) produces wrong positions of children entities in some animations, misplacing of particle emitters, and problems selecting specific children entities to hide them. Leon's method is much more simple and faster. In case you are a really very clean 3d-designer and animator, entityparent(a,b) could be right. But if you need pre-transforming meshes before adding them to skeleton, patching object positions or sizes, rotate children entities, deform meshes etc. using addmesh(a,b) it's easier to make it. Greets!


Ross C(Posted 2008) [#7]
I didn't realise addmesh assigned vertices to bones? How does the addmesh command know what bones to assign the adding mesh?


RGF(Posted 2008) [#8]
Before I add a secondary mesh to another main mesh, all of its vertex have already been assigned to specific bones in ms3d, of course you must use the same skeleton for both models. Then I export the mesh as *.b3d. Exported mesh already contains information about vertex assignation to bones. Later, when loading meshes in blitz, use first loadanimmesh(a), then addmesh(a,b). This way, added mesh retains bones information, and fits perfectly in animated sequences.


Ross C(Posted 2008) [#9]
Hmmm, interesting approach. I've never really had any problems with parenting guns and such to characters hands, or backpack/shoes etc.

Another way i though, was include everything that was to be attached to the mesh, and simply use vertexalpha to hide the parts i wouldn't need.