Toggle flashlight visible and not

Hello. Im making a game kinda lika Penumbra. And i want a flashlight to come visible when i press “F”, but how do i do so it disapears when i press “F” again? Sry for the bad english xD All help whould be lovely :slight_smile:

script or just logic will help.

Hi Kerion,

you can animate the lamp’s energy using ipo and use states and the ipo actuator to switch for example from frame 1 where the energy of the lamp is 0.0 to frame 2 where its energy is 1.0.
I can post an example if you don’t get it.

Jay-D

an example whould be sweet! but i need the “mesh flashlight” to disapear same as the light. Whould help me allot

Okay, here’s the example: link
You can use the same setup for the flashlight mesh with either an animation or the visibility actuator. If you want to know more about the states-system and the actuators, I recommend cthames’s site: tutorialsforblender3d.com , a great site that helped me a lot.

Jay-D

Ohh damn! thank you soooo much! really needed this! :smiley:

btw… what hotkey is it to insert an IPO curve so you actully can make that effect? :stuck_out_tongue: never used IPO

nvm :slight_smile: fixed it :smiley:

Glad I could help you.
The hotkey would be I (that’s an uppercase i not lowercase L) in this case with the mouse over the lamp’s Shading menu (F5).

Jay-D