Jump to content



Photo
- - - - -

Color changing lamps


Best Answer BilboX , 13 May 2014 - 02:05 PM

No, it is possible. You have to get the basiclamp behaviour:

BxBasicLamp lb = AddLamp("Bulb3",10);

Then you can dynamically change two color values, for lit and unlit colors:

//!< color when lamp is lit
lb.m_lit = Color(10,56,250);

//!< color when lamp is unlit
lb.m_unlit = Color(1,5,25);

If you call this in an undate loop, you can interpolate r,g,b.

 

We'll make a "utility" function if this is widely used...

Go to the full post


  • Please log in to reply
3 replies to this topic

#1 chepas

chepas

    t.me/horsepin

  • Members
  • PipPipPipPip
  • 1,966 posts

  • Flag: ---------

  • Favorite Pinball: BSD, Tr0n, SW:Stern

Posted 13 May 2014 - 01:32 PM

Clear inserts with color changing lamps a possibility?

 

Feel as though I could be asking too much here but has it ever been done in a sim yet? :BDH:

 

 


Bump maps are the new auto-tune :BDH:
VPX - RSS Updates ---- blog.flippingflips.xyz/en/ -- Visual Pinball No.1 (2021) . Est.2000


#2 BilboX

BilboX

    Enthusiast

  • Unit3D Pinball Team
  • 433 posts
  • Location:French Polynesia

  • Flag: France

  • Favorite Pinball: Metallica, Addams Familly, Scared Stiff, White Water

Posted 13 May 2014 - 02:05 PM   Best Answer

No, it is possible. You have to get the basiclamp behaviour:

BxBasicLamp lb = AddLamp("Bulb3",10);

Then you can dynamically change two color values, for lit and unlit colors:

//!< color when lamp is lit
lb.m_lit = Color(10,56,250);

//!< color when lamp is unlit
lb.m_unlit = Color(1,5,25);

If you call this in an undate loop, you can interpolate r,g,b.

 

We'll make a "utility" function if this is widely used...


UP2


#3 chepas

chepas

    t.me/horsepin

  • Members
  • PipPipPipPip
  • 1,966 posts

  • Flag: ---------

  • Favorite Pinball: BSD, Tr0n, SW:Stern

Posted 13 May 2014 - 02:07 PM

Wow. Sweet.

 

 

We'll make a "utility" function if this is widely used...

 

I'd like to use it in all original tables but you gotta think from now until whenever most tables these days will be standard procedure.


Bump maps are the new auto-tune :BDH:
VPX - RSS Updates ---- blog.flippingflips.xyz/en/ -- Visual Pinball No.1 (2021) . Est.2000


#4 chepas

chepas

    t.me/horsepin

  • Members
  • PipPipPipPip
  • 1,966 posts

  • Flag: ---------

  • Favorite Pinball: BSD, Tr0n, SW:Stern

Posted 30 June 2014 - 09:31 AM

    public void LampOn(int r,int g,int b)
    {
        BxBasicLamp neh = (BxBasicLamp)AddLamp("EyeBulb", 23, "BxBasicLamp");
        neh.m_lit = new UnityEngine.Color(r,g,b);
        // neh.m_onTime = 10f;
        neh.Start();
         neh.TurnOn();
       // SetSolenoid(23, true);
    }

Couple of things here. I've had to cast the (BxBasicLamp) & use the new keyword on color from your original code.

 

I can't get it to turn on though without the SetSolenoid. It comes on but shuts off straight away, not sure how to do this.

 

"neh.m_onTime = 10f;" .. This turns it on but slowly gets brighter until it can't get any more brighter.


Bump maps are the new auto-tune :BDH:
VPX - RSS Updates ---- blog.flippingflips.xyz/en/ -- Visual Pinball No.1 (2021) . Est.2000