Trouble with light switch

I know there are quite a few topics to do with light switches but I'm really having trouble getting this to work.. I have 3 objects; - sphere (player) - cube (wall) - light

I want to make it so when the player hits the wall, it switches on a light.. I'm trying to get all this done in JavaScript but because I'm still learning it seems to be giving me trouble.. any help would be great! ^_^ Thanks.

Make sure you have physics colliders on all of your GameObjects.

Then, make sure you enable the "Is Trigger" in the Wall GameObject.

You can choose from a number on OnCollision Functions to complete this.

Is this helpful? I can give you more advice if you have more details to share about what you want to accomplish.

You may also want to check out Tornado Twins - Understanding Triggers Video Tutorial

Turns out my light switch was fine.. I tried:

var linkedLight : Light; //this is liked to a light which is switched off

function Update ()

{

if (Input.GetKey("q"))

{

linkedLight.enabled = true;

}

}

This worked fine.. when I run the game and press "q" the light switches on.. so I guess my problem lies in the collision... I'm using:

function OnCollisionEnter(triggerLight : Collision)

{

if(triggerLight.gameObject.tag == "wall")

    {

    linkedLight.enabled = true;

    }

}

Well I finally got this thing working!

var linkedLight : Light; //linked to switched off light

function OnControllerColliderHit(triggerLight : ControllerColliderHit)

{

if(triggerLight.gameObject.tag == "wall") //"wall" is the tag on the wall I'm colliding with

{

linkedLight.enabled = true;

}

}

Sorry to bother everyone with the question.. but thanks a lot for the resources, it took me a while, but I finally figured it out :) Now I can add some variables to toggle the light back off again!