Game engine: make an object appear

Hey everybody,

I’m not very good with Blender, so maybe this question seems a bit silly…

I want to make an object appear (say, a treasure) in my game, but only when the player (a cube/camera combination) comes near it. The player should not see where the object is from farther away! I guess there is away to do this by using the logic bricks (near sensor?) but I can’t really figure it out.
After the treasure appears the player needs to touch it, so that the next level can start.

Thanks!

set the object as invisible in the blender UI.

Then, have a near sensor hooked up to a visibility actuator.

Then you can have a collision sensor, which changes the scene or something to get to the next level.

Beside making the object invisible as mokazon suggest there are other options:

  • hide the object somewhere (e.g. under the ground)
  • add the object when needed (place the original object to be added at an hidden layer - use the Edit object/add Object actuator)
  • make the material full transparent and play a material action to smoothly fade the transparency to opaque.

It’s me again. I’ve tried the thing with setting the object to invisible/near sensor and it works. However, I can’t make it dissappear again. The reset distance of the near sensor is already higher than the detection distance, so that’s not the problem.

What I want is to make an object appear when the player is at a certain distance to it (that’s the part that already works), but I also want the object to disappear again as soon as the player moves away from it…

I made a little example, using the ‘invert’ button, you can invert the sensor.
Here you go. I don’t know why the near sensor won’t work (just one sensor).
ExampleVisibilty.blend [PasteAll]
Use the arrow keys to move. :wink:

Thanks RossBlenderArt! That works :slight_smile:

you can use the same sensor but additional connect with a NOR or NAND will do the trick :wink: