Hi
I want to translate shaft caster game object to directional lights lens flare position.
How can i found directional lights lens flare position in my code?
Screenshots
Hi
I want to translate shaft caster game object to directional lights lens flare position.
How can i found directional lights lens flare position in my code?
Screenshots
I found the solution
Attach this script to shaft caster empty game object and assign directional light as dirLight.
After that, remove attached script
Note: Sun shaft works great on mid range mobile devices with medium quality
based on this answer:Get skybox sun - Questions & Answers - Unity Discussions
using UnityEngine;
using System.Collections;
[ExecuteInEditMode]
public class glp : MonoBehaviour {
// Use this for initialization
public Transform dirLight;
void Update ()
{
if (dirLight)
transform.parent = dirLight;
transform.position = dirLight.position;
transform.localPosition = new Vector3 (transform.localPosition.x, transform.localPosition.y,
transform.localPosition.z + -7000f);
}
}