Jump to content

Gaius Goodliffe

Resident
  • Posts

    29
  • Joined

  • Last visited

Reputation

0 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. It's pretty much as simple as determining when it's on the horizon. Just as you can tell whether the sun is above or below the horizon looking at the z-axis, and know it just crossed the horizon when it transitions from positive to negative or back, you can look at the x-axis for whether it's east or west of your "longitude", and know that it's just past its zenith or nadir when the x-axis transitions from positive to negative or back. In theory, the sun is exactly on the horizon when z=0.0, and exactly at its zenith or nadir when x=0.0, but I'm not sure if it ever has that exact value, so you might have to watch for the transition across, or do a fuzzy compare. Incidentally, the sun position updates every 10 seconds, so llSetTimerEvent(10.0) will let you poll the sun position and theoretically (in a world with no lag) catch every single value llGetSunDirection() returns during the day. It would be sufficient to simply save the last result in a global variable, and check to see if the sign of x or z had changed since the last tick. This would work even if you missed ticks due to lag, or use a longer time between timer events, say llSetTimerEvent(60.0) if you don't care to be more accurate than to the nearest minute.
×
×
  • Create New...