Question by
avi1708 · Apr 23, 2016 at 04:25 PM ·
scripting problemskybox
Skybox rotation
I am trying to rotate the skybox using a script attached to a second camera with clearflags set to skybox, culling mask set to none, and depth lower than the main camera. However as soon i start moving around a bit the skybox starts rotating along with the main camera.
Please help.
I tried two different scripts. both give same results.
one.
void Update ()
{
transform.Rotate (new Vector3 (1, 1, 1) * Time.deltaTime);
}
two
private Vector3 rotationValue;
private float turnVal ;
void LateUpdate ()
{
turnVal = Time.deltaTime;
rotationValue = new Vector3 (Camera.main.transform.rotation.eulerAngles.x + turnVal, Camera.main.transform.rotation.eulerAngles.y + turnVal, Camera.main.transform.rotation.eulerAngles.z + turnVal);
transform.rotation = Quaternion.Euler (rotationValue);
}
Comment