Appear and Disappear

How can I setup my logic blocks so that when my character is near a object, an ‘action’ mesh will pop out and when the character move away from the object, the ‘action’ object disappear. Something like an on/off switch.

see the visibility actuator

If you want to work your thing without python scripting
you could send a message (message actuator) from the object (the one you will come close to) to your other “action” object (that one will need a message sensor).

Then connect this message sensor owned by the “action” object to an AND controller (or what you want else) and a visibility actuator.

Hi zos! Thanks again but the problem is that my near sensor will not reset the object back to invisibility.

An inversed near sensor can reset the object for you.

Na… I think I may need python. After definding all the sensor and actuator, How can I ‘on’ that actuator. Like, if mySensor.isPositive(): execute myActuator action.

cont = GameLogic.getCurrentController()
own = cont.getOwner()
sensor = own.getSensor("<i>sensor name</i>")
act = own.getActuator("<i>actuator name</i>")

if sensor.isPositive():
    GameLogic.addActiveActuator(act, 1)

Replace the italicized names with the real names of your sensor and actuator. The number “1” means “on” in computer speak, “0” means “off”.

Sorry guys. Could you please check this out for me?

I want it when my player move over the white plane area to add an object that is in the 2nd layer to the current layer and when my player is out of the plane, the object is removed. I know I can use the Near sense but the reset don’t work for this.

You can also, just use an if expression controller instead of the AND controller.

How should I use this? Will it be able to use it like a switch in appear and disappear?

Ok… I’m trying to use python to work… able to get it to appear but not disappear… can someone take a look at this?

Just to share with you guys… I found another way. Not really what I want but it should do for now.