[BGMC17]One armature - multiple replace meshes

Hi! I have one 2-boned armature for my fish so it can “paundler” when on hook(paundler is paddle + flounder). I have multiple fish meshes(OK, right now just perch, but will have more) which to replace according to fish. How do I use one armature and replace mesh of the object parented to it and keep armature working fine and affect new mesh? Will it work if all meshes will have the same called vertex groups at similar positions?

OK! Great!


fishVis.replaceMesh("Fish" + str(own["fish"]), True, False)

This doesn’t appear to replace mesh. I see the Fish0 mesh all the time, althouh own[“fish”] is larger than 0.

Hello? This is very important for my game!

have you checked?


... 

targetMeshName = "Fish" + str(own["fish"])
fishVis.replaceMesh(targetMeshName , True, False)

print( "the object {} has mesh {} should be {}".format(fishVis, fishVis.meshes[0].name, targetMeshName ) )
...

The console outputs correct mesh…

Then you might work with a different object than you think you are.


...
own.localScale = [5.0, 5.0, 5.0]


obviously this is a temporary snippet, just to see if the right fish is touched.

Edit: It often happens to confuse object name with mesh name. I suggest to double check the mesh names (in the mesh tab)

Oh, yeah - after reading my code closer, I found out that I actually modified the armature’s mesh not the meshes one:D But armature can’t have a mesh…

*** LoL ***