var linkedLight : Light; //the light that SHOULD turn on when Red Barrels collision is detected
var aimLight: GameObject; //the game object the light is attached to that aims the light at the Barrel as it rolls
function OnTriggerEnter (other:Collider) {
if (name == "RedBarrel") {
linkedLight.enabled = !linkedLight.enabled;
aimLight.GetComponent(smoothLookAtConstraint).enabled = true;
}
}
THE PROBLEM: The light doesn’t come on AND the smoothLookAtConstraint script doesn’t get enabled When the barrel rolls through the collider
The exposed variables linkedLight and aimlight have their correct objects attached to them in the scene, through the inspector.
There is a box collider in the scene that is a trigger that I am rolling barrels through. The Script above is attached to it.
When they come in the collision area, I want the light to turn on and start aiming at the barrel until it is no longer inside.
I have gone through so many other scripts on here and can’t get it to work.
My error now with this code tells me Unknown identifier: ‘smoothLookAtConstraint’.
From what I’ve read, using GetComponent allows me to access scripts within a gameobject.But i guess not?
This is the code I have so far.
Any help would be appreciated, gonna pull out the little bit of hair I have