I want to make a raycast acces panel with lights
Assigned this to the main camera:
var CODELIGHT : Light;
function Update()
{
flashlight = GetComponent("Light");
}
{
if (Input.GetKeyDown(KeyCode.E))
{
var hit : RaycastHit;
if (Physics.Raycast(transform.position, transform.forward, hit, 2.0F))
{
if(hit.transform.tag == "Obj1")
{
{
if (flashlight.enabled) {
CODELIGHT.enabled = false;
}
else {
CODELIGHT.enabled = true;
}
}
}
}
}
}
hooked the script up to the main camera en made a cube with a boxcollider as trigger, tagged the cube Obj1. And assigned a pointlight to the script, but sadly… No succes:(