Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var mainCamera : Camera;
- var value;
- function Start()
- {
- if (mainCamera == null)
- mainCamera = Camera.main;
- //this ignores the value set in inspector - makes bulk setting easier.
- value = 0.05;
- }
- function Update ()
- {
- if(mainCamera)
- {
- var heading: Vector3 = gameObject.transform.position - mainCamera.transform.position;
- var dot: float = Vector3.Dot(heading, mainCamera.transform.forward);
- gameObject.GetComponent(LensFlare).brightness = (value/dot) * transform.lossyScale.magnitude;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement