6
$\begingroup$

I am trying to model car light for my game in blender. I want to change light's color when car stops or starts. I have tried couple of things such as changing emit color of current lights to emulate light source but as they are static material property ,it did not work for me (I can not access them through game engine controller ). I also tried placing half transparent object (which i can change their color through controller) in front of object whose emit property is set. But this did not also work as i can't manage color of half transparent object. Picture shows back lights with emit property set

Is there any way easy to do this (changing emitting color of object dynamically)? Or am I missing something in my half-transparent object?

$\endgroup$
1
$\begingroup$

Well, I don't see any answers yet, so ill tell you the best I know. I also don't know this, but I know a simple technique that I use for this subject until I figure out how to actually do it. In another scene(Can be accessed by pressing "2"), put a red light, white light or whatever, and edit it however you'd like. Then, go to scene 1, and in the logic bricks put [Keyboard>And>Edit object] Put Add object in the edit object logic brick, and select the light. Now when you press space, or "A" or whatever a light will show up quickly and leave. You can add more time but the problem is that the light stays in place just as if its static, so if you can get it to move with the glass(Parenting doesn't work, already tried) then this would work flawlessly. Sorry I don't know much, but its the best I can answer.

$\endgroup$
  • $\begingroup$ I see your point and probably this would be a good approach but i found simpler one. I placed solid object in front of emitting object that i can make it visible / invisible through controller script. Since i can not change the color of light, i separated lights with different colors, for instance i put rear white lights on bumper. $\endgroup$ – Kamyar Jan 6 '14 at 21:29
2
$\begingroup$

As The basicTroublemaker answered, just use 'ReplaceMesh' in stead of 'Add Object'. This way only the visual apearence will change and nothing else.

$\endgroup$
2
$\begingroup$

If you just want to change the colors of a mesh do like kammirzazad said.

But if you want to change the color of a actual light I'd say animate it. 3 Steps to go:

  1. Select the Point/Hemi or what light you have. Go to Frame 0 and open the properties.
  2. Set the Default-Color of your light; then, with the mouse on the color-field, press 'I' to add a Key. Go to Frame 1 and set the second color. Add a keyframe with I. Repeat until all colors needed are in.
  3. Set Action-Actuators to the light-object (one for each color). On each one set startframe and endframe of the action to the frame used for the color.
  4. In the Dopesheet you may edit the animation.

I'll try uploading an example later

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.