Hello unity folk,
Im trying to set a materials intensity of an object when it enters a box collider. I have the (Car/LightsEmmissive) shader from the car tutorial on my material, the script below is on an object (brakezone) that has a box collider, brakelights var is assigned in the inspector. Im pretty sure its the Mathf.Abs part that’s wrong. Been playing with this for days and cant get it right.
Ive just started using unity and would love some advise. If im on the right track or not. Ive pieced together this scrip from others. Again any feedback would be great. Thanks!
@script RequireComponent (BoxCollider)
public var brakeLights : Material;
function OnTriggerEnter (other : Collider) {
if(other.name == "AI_Car-Charger")
brakeLights.SetFloat("_Intensity", Mathf.Abs(other));
else
brakeLights.SetFloat("_Intensity", 0.0);
}`enter code here`