Hello
I have a problem with swaping a mesh for my objects. I initialize each enemy mesh like this:
I want to change the mesh dynamicly for enemis when f.ex. they are killed so I use once again:
Hello
I have a problem with swaping a mesh for my objects. I initialize each enemy mesh like this:
dettach the old one from its parent and attach the new one. Also, just load your assets once, if you wanna have a copy from the original asset, just use the “clone()” method.
Ok, so I tried to detach the object from its parent node “enemies”, set the new mesh and add it once again:
No. I think it’s no the problem. But, what does your “setMesh()” method? We are talking about spatials, not meshes ok? Also, why are you loading the model each iteration? Load it just once and call “clone()” from the original one. Posting here the strack trace could be nice too!
Thanks for the tip with the clone() method. My setMesh() method initializes a Node field in each “Pig” object instance. I attach these nodes to “enemies” Node and then attach enemies Node to rootNode.
Btw could you post the stack trace?
Here is what DDMS says:
Yeah! I fixed it! It was a lack of defined material for new mesh