x


Sun coordination with Skybox

Is there a way to make sure the directional light for a scene is where the skybox's "sun" is? Thanks.

more ▼

asked Oct 06 '10 at 12:34 AM

Mentalist4006 gravatar image

Mentalist4006
150 20 20 29

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

You'll have to do it manually by positioning the directional light where the "sun" should appear to be for the player. The good thing is that the directional light can be outside the playable area so that it always appears to be in the same place as the sun in the skybox. Turning on your sky in the scene view can help you align it properly.

more ▼

answered Oct 06 '10 at 04:12 AM

Adam Rademacher gravatar image

Adam Rademacher
1.2k 1 4 22

(comments are locked)
10|3000 characters needed characters left
using UnityEngine;
using UnityEditor;

public class DirectionHelper : Editor
{
    [MenuItem("Healpers/SetLightDirection")]
    static void SetDirection()
    {
        Transform selected = Selection.transforms[0];
        if(!selected)return;
        selected.forward = -SceneView.lastActiveSceneView.camera.transform.forward;
    }
}

Instruction

more ▼

answered Sep 06 '12 at 01:27 PM

mouurusai gravatar image

mouurusai
280 1 4 6

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1888
x594
x234
x38

asked: Oct 06 '10 at 12:34 AM

Seen: 3827 times

Last Updated: Sep 06 '12 at 04:56 PM