Jump to content

Light switches


spritefire
 Share

Recommended Posts

If I have 6 lights (3 enabled at the start) and then I have a mesh interact with another mesh how would I get it to act like a light switch and turn off one set and enable another set?


it's 7am and my brain isn't working anymore. 


I've tried: 

            scene.cube1.actionManager = new BABYLON.ActionManager(scene);            scene.cube1.actionManager.registerAction(new BABYLON.ExecuteCodeAction({ trigger: BABYLON.ActionManager.OnIntersectionEnterTrigger, parameter: scene.sphere }, lightsOn("switchOne"),true));            scene.cube1.actionManager = new BABYLON.ActionManager(scene);            scene.cube1.actionManager.registerAction(new BABYLON.ExecuteCodeAction({ trigger: BABYLON.ActionManager.OnIntersectionEnterTrigger, parameter: scene.sphere }, lightsOn("switchTwo"),true));

and having a lightsOn function call one set enabled and the other disabled (depending on what is passed through the function)
ie  

                        light1.setEnabled(0);                        light2.setEnabled(0);                        light3.setEnabled(0);                        light4.setEnabled(1);                        light5.setEnabled(1);                        light6.setEnabled(1);

can't seem to get it to work..

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...