Ghost objekt on/off in ge

how can I turn the Ghost mode of an objekt on/off when the game engine is running?

There is a visibility actuator in the game logic that you can use

Assuming that meshes describe the objects physics, create a duplicate objects so that you have one obj with ghost, one without, then use replacement mesh actuator

ghost mode has nothing to do with visibility. if you have ghost mode activated as physics type, there are no more physical collisions on that object, wheras the collision detection remains.

the replace mesh actuator does only replace the mesh, and the physics setting are linked to the object, not the mesh.

but you can parent the object to another one at runtime using the parent actuator, selecting the ghost option of the actuator, which makes the object a ghost as long as it is parented.
maybe you could use two parent actuators on that object, having it always parented to an empty and just switching which one of the actuators actually parents it.

No, this is not true. The physics settings are actually tied to the mesh. When using the replaceMesh actuator or python binding, it replaces the graphics mesh, but you may choose to also change the physics mesh. However, in this case, the physics parameters (which may have been what you’re referring to) are native to the object, so it’s sort of a mix.
However, i would just use an EndObject and AddObject combination.

If the object your changing is parented to another object then you can use the setParent() method to switch between ghost and solid.

agoose77 of course you’re right at this point, i have misunderstood you there. my fault. thought you meant to replace with a mesh with different physics settings, but of course replacing the physics mesh with an “empty” mesh should work.