Is there a way to make the objects emit an emit value when you press a key Blender Game Engine. It is quite hard to explain. But I am designing a car game, and when I press the brake key, I want my rear lights to emit and flash. Can somebody please help me out?
Thanks in advance!
A good way to fake a bright lamp is to make a plane with a glare texture, place it right in or on top of the light source, and use the “halo” face orientation mode with the additive blend mode. Simply make the plane invisible when the light is not shining. Blender has a z-offset setting to make the halo always draw over the light itself.
If you wanted to get even fancier, you could attach a point lamp to each brake light, and toggle it’s brightness to turn it on or off (I think you can animate light intensity with actions, then play the action using the action actuator logic brick).
The above two options would only be necessary if for nighttime conditions. In daytime conditions, the light wouldn’t appear as bright, so you could get away with simply changing the brightness of the texture.
To do this, you could use a python script to swap out the brake light texture for a lightened version, where the brake lights look like they are lighting up (alternatively, you could place the two versions of the texture side-by-side in a single texture and use Python to shift the UV coords).
Some of the techniques I mentioned can probably be found with a Google or BA forum search, but if you need more detailed instructions, I’ll be happy to help.
Thank you very much! But I can’t find a python script anywhere. Apart from that, I have a scene with a bright lamp and a glare texture set to halo. I just need a script. Oh, and also, I know how to keyframe the intensity of light, however I don’t know how to implement this into the Game Engine? Thanks!
Once you’ve keyframed the intensity of the light, playing it in the GE is simple. You use the action actuator, like you would for playing any action. You can also set the action actuator to “property mode”, so the frame of the action will be determined by a GE property (which is what I did in my example file). Here’s an example file:
LightAnimation.blend (388 KB)
Start the game, press 1 to turn off the lamp, press 2 to turn it on again.
For some odd reason, I noticed that you can’t choose the name of a lamp action. I tried to keyframe an action called “On/Off”, but Blender created an action called LampAction and inserted the keyframes there instead. It’s just an odd quirk, i guess.
As for the Python script, I’ll look into it. If I can’t find one, I’ll make it.
Thank you very, very much! I don’t know how to thank you! I really appreciate your help. Thank you very much again