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, 2010 at 12:34 AM

Mentalist4006 gravatar image

Mentalist4006
150 52 40 49

(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, 2010 at 04:12 AM

Adam Rademacher gravatar image

Adam Rademacher
1.2k 3 5 26

(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

=qIAWeSCb_ac

more ▼

answered Sep 06, 2012 at 01:27 PM

mouurusai gravatar image

mouurusai
295 2 6 11

This worked wonderfully for me. Much easier then setting it manually like I was before.

May 09 at 04:13 AM WyvernSpite
(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:

x2124
x648
x247
x39

asked: Oct 06, 2010 at 12:34 AM

Seen: 4415 times

Last Updated: May 09 at 04:13 AM