Material Animation and ReplaceMesh

I have a material animation that will display on a variety of different meshes regardless of their primary material (Simply changes diffuse intensity).

In my game context this mesh is a character mesh. Instead of adding a separate object for each character the player could select, I simply swap out the mesh using own.replaceMesh(). When I do this however, the material animation will no longer play. Is this because the material animation references a material slot and the material slots change when I use own.replaceMesh()? For comparison I also tested using the actuator as well, and I had the same result.

For simplicity sake, I would rather avoid creating instances of other object trees (coll box, rig, mesh + more) to just do this one simple function.

Thanks for your time,

Little Sprite

Do you have a minimal *.blend which shows the issue?
You should mention if it’s based on Vanilla BGE (=2.79 b) or some UPBGE derivative.

I’m not sure if this is the correct solution, but perhaps manually defining the material animation to the selected object would help?

| PYTHON | function for playing animations -

cont.owner.playAction()

Version 2.76
When I created a minimalistic version I realised that it worked like I had originally intended it to, and the problem criteria I had assumed was incorrect.

I’m not sure how, but I created a work-around if not solved the actual problem by moving the referenced meshes to the active layer. This was incredibly un-intuitive to me since whenever you add an object to scene it needs to be available on an inactive layer.

1 Like