replace mesh in bge

Hi there,

I wanna ask about replacing mesh in bge. I have 3 mesh. Mesh A is the original mesh and mesh b an c is the replacement mesh. i wanna to replace mesh A to mesh b, then mesh b to mesh c and mesh c to mesh a back. it will be a loop, the mesh will be replace when the key is pressed. I have position mesh A, B, C in different layer. I can change mesh a to mesh b but could’nt continue to mesh b to mesh c and further. How can i do this, any python script involved? please give me some points. thank you very much.

What seems to be the problem, since nothing pops out as wrong with that description - you should be able to replace the mesh as many times as possible. You’re doing it with logic bricks, right?

Put a dummy object X in visible layer.
put the objects A,B,C in a hidden layer.
Now when game starts make sure that the mesh of dummy object is replaced by the script

from bge import logic as gl
cont=gl.getCurrentController()
own=cont.owner
own.replaceMesh("A")

Do the same to load other meshes as well.

Hi there thanks for your reply.

I want the mesh to be replaced by pressing let’s say “r” key. What i did was placed object A in visible layer with the property int, value=1. In logic brick, placed a keyboard sensor which is the “r” key connected to AND controller, connected to replace mesh to object B which is in 3rd layer and i also connect (actuator)property “prop” value = prop+1

And for the second sensor I did property “prop” value =2 and the keyboard sensor “r”, connect in to AND controller and connect it to replace mesh to object C (which is in 4th layer). But the mesh isn’t replacing.

Basically, when i press the key"r" for the first time, the object A will replace with object B. If I press “r” again the replaced object (object B) will be replaced to object C. I’m not sure how to do it. I tried few other way but I was only managed to change 1 time only.

I’m using blender 2.49 by the way, thanks for looking into it.
![http://172.25.167.161/C:/Users/Niven Peter/Desktop/Interior scene/logicbr.jpg](http://172.25.167.161/C:/Users/Niven Peter/Desktop/Interior scene/logicbr.jpg)