Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Help needed for llGetSunDirection

Allen Harrington
Registered User
Join date: 14 Jul 2005
Posts: 60
03-21-2006 11:02
I tried a forum search for “llGetSunDirection” and did not get any results. From what I can understand in the wiki it returns a vector, where each of the three parameters range from –1 to +1. I could not find an example of its use. I assume z would be the height of the sun where a positive value would be day and a negative would be night. But what about x and y. If the sun were to the southwest, (135 degrees clockwise from east), would x = 0.5 and y = -0.5?

I’m trying to create a stain glass window in which the inside texture is full-bright during the day and the outside texture is not full-bright. At sunset I want it to be reversed as if the light source was in the inside. So I only need to know the general direction of the sun and the sign of the vector’s z value may be all I need. I read about reading the llGetTimeOfDay but it also said if the Sun is stopped by the private island owner the clock will continue to count thereby possibly causing my script to think it’s night when the sun is actually still out.

Thanks
_____________________
Photo Gallery at www.tigerzero.com
Anthrocon 2004 & 2005 photos at www.tigerzero.com
Yeti Freeloader
Registered User
Join date: 6 Dec 2005
Posts: 13
03-21-2006 16:26
you are correct in that you only need the z value . . . if it's positive it's after sunup and before sundown (ie day) . . . opposite for neg values
Nexus Nash
Undercover Linden
Join date: 18 Dec 2002
Posts: 1,084
03-21-2006 22:17
Just to add, the llGetSunDirection() is a norm vector from your current position towards the sun in SL. You're right on the Z. The x and y are global coords used to find time of day :) This is how someone would build a clock telling time from the sun in SL. I built one a long time ago, used some trig and llGetSunDirection, works nicely. Also very nice to cast shadows on stuff. IE automatic shadows :)
_____________________