De DigiWiki.
(Différences entre les versions)
|
|
| Ligne 7 : |
Ligne 7 : |
| | |- | | |- |
| | | '''Sunset''' || 2:30 AM || 3:30 AM || 10:30 | | | '''Sunset''' || 2:30 AM || 3:30 AM || 10:30 |
| | + | |- |
| | + | | '''Midnight''' || 3:00 AM || 4:00 AM || 11:00 |
| | + | |- |
| | + | | '''Sunrise''' || 3:30 AM || 4:30 AM || 11:30 |
| | + | |- |
| | + | | '''Sunset''' || 6:30 AM || 7:30 AM || 14:30 |
| | + | |- |
| | + | | '''Midnight''' || 7:00 AM || 8:00 AM || 15:00 |
| | + | |- |
| | + | | '''Sunrise''' || 7:30 AM || 8:30 AM || 15:30 |
| | + | |- |
| | + | | '''Sunset''' || 10:30 AM || 11:30 AM || 18:30 |
| | + | |- |
| | + | | '''Midnight''' || 11:00 AM || 12:00 PM || 19:00 |
| | + | |- |
| | + | | '''Sunrise''' || 11:30 AM || 12:30 PM || 19:30 |
| | + | |- |
| | + | | '''Sunset''' || 2:30 PM || 3:30 PM || 22:30 |
| | + | |- |
| | + | | '''Midnight''' || 3:00 PM || 4:00 PM || 23:00 |
| | + | |- |
| | + | | '''Sunrise''' || 3:30 PM || 4:30 PM || 23:30 |
| | + | |- |
| | + | | '''Sunset''' || 6:30 PM || 7:30 PM || 2:30 |
| | + | |- |
| | + | | '''Midnight''' || 7:00 PM || 8:00 PM || 3:00 |
| | + | |- |
| | + | | '''Sunrise''' || 7:30 PM || 8:30 PM || 3:30 |
| | + | |- |
| | + | | '''Sunset''' || 10:30 PM || 11:30 PM || 6:30 |
| | + | |- |
| | + | | '''Midnight''' || 11:00 PM || 12:00 AM || 7:00 |
| | + | |- |
| | + | | '''Sunrise''' || 11:30 PM || 12:30 AM || 7:30 |
| | |- | | |- |
| | |} | | |} |
| - |
| |
| - |
| |
| - | <table border="1" cellspacing="0">
| |
| - | <tr align="center" valign="top" class="tab_title"><td style="padding-left:3px;padding-right:3px"> <b>Phase</b> </td><td style="padding-left:3px;padding-right:3px"> <b>PST</b> </td><td style="padding-left:3px;padding-right:3px"> <b>PDT</b> </td><td style="padding-left:3px;padding-right:3px"> <b>GMT</b> </td></tr>
| |
| - | <tr class="tab_row_uneven"><td style="padding-left:3px;padding-right:3px"> <b>Sunset</b> </td><td style="padding-left:3px;padding-right:3px"> 2:30 AM </td><td style="padding-left:3px;padding-right:3px"> 3:30 AM </td><td style="padding-left:3px;padding-right:3px"> 10:30 </td></tr>
| |
| - | <tr class="tab_row_even"><td style="padding-left:3px;padding-right:3px"> <b>Midnight</b> </td><td style="padding-left:3px;padding-right:3px"> 3:00 AM </td><td style="padding-left:3px;padding-right:3px"> 4:00 AM </td><td style="padding-left:3px;padding-right:3px"> 11:00 </td></tr>
| |
| - | <tr class="tab_row_uneven"><td style="padding-left:3px;padding-right:3px"> <b>Sunrise</b> </td><td style="padding-left:3px;padding-right:3px"> 3:30 AM </td><td style="padding-left:3px;padding-right:3px"> 4:30 AM </td><td style="padding-left:3px;padding-right:3px"> 11:30 </td></tr>
| |
| - | <tr class="tab_row_even"><td style="padding-left:3px;padding-right:3px"> <b>Sunset</b> </td><td style="padding-left:3px;padding-right:3px"> 6:30 AM </td><td style="padding-left:3px;padding-right:3px"> 7:30 AM </td><td style="padding-left:3px;padding-right:3px"> 14:30 </td></tr>
| |
| - | <tr class="tab_row_uneven"><td style="padding-left:3px;padding-right:3px"> <b>Midnight</b> </td><td style="padding-left:3px;padding-right:3px"> 7:00 AM </td><td style="padding-left:3px;padding-right:3px"> 8:00 AM </td><td style="padding-left:3px;padding-right:3px"> 15:00 </td></tr>
| |
| - | <tr class="tab_row_even"><td style="padding-left:3px;padding-right:3px"> <b>Sunrise</b> </td><td style="padding-left:3px;padding-right:3px"> 7:30 AM </td><td style="padding-left:3px;padding-right:3px"> 8:30 AM </td><td style="padding-left:3px;padding-right:3px"> 15:30 </td></tr>
| |
| - | <tr class="tab_row_uneven"><td style="padding-left:3px;padding-right:3px"> <b>Sunset</b> </td><td style="padding-left:3px;padding-right:3px"> 10:30 AM </td><td style="padding-left:3px;padding-right:3px"> 11:30 AM </td><td style="padding-left:3px;padding-right:3px"> 18:30 </td></tr>
| |
| - | <tr class="tab_row_even"><td style="padding-left:3px;padding-right:3px"> <b>Midnight</b> </td><td style="padding-left:3px;padding-right:3px"> 11:00 AM </td><td style="padding-left:3px;padding-right:3px"> 12:00 PM </td><td style="padding-left:3px;padding-right:3px"> 19:00 </td></tr>
| |
| - | <tr class="tab_row_uneven"><td style="padding-left:3px;padding-right:3px"> <b>Sunrise</b> </td><td style="padding-left:3px;padding-right:3px"> 11:30 AM </td><td style="padding-left:3px;padding-right:3px"> 12:30 PM </td><td style="padding-left:3px;padding-right:3px"> 19:30 </td></tr>
| |
| - | <tr class="tab_row_even"><td style="padding-left:3px;padding-right:3px"> <b>Sunset</b> </td><td style="padding-left:3px;padding-right:3px"> 2:30 PM </td><td style="padding-left:3px;padding-right:3px"> 3:30 PM </td><td style="padding-left:3px;padding-right:3px"> 22:30 </td></tr>
| |
| - | <tr class="tab_row_uneven"><td style="padding-left:3px;padding-right:3px"> <b>Midnight</b> </td><td style="padding-left:3px;padding-right:3px"> 3:00 PM </td><td style="padding-left:3px;padding-right:3px"> 4:00 PM </td><td style="padding-left:3px;padding-right:3px"> 23:00 </td></tr>
| |
| - | <tr class="tab_row_even"><td style="padding-left:3px;padding-right:3px"> <b>Sunrise</b> </td><td style="padding-left:3px;padding-right:3px"> 3:30 PM </td><td style="padding-left:3px;padding-right:3px"> 4:30 PM </td><td style="padding-left:3px;padding-right:3px"> 23:30 </td></tr>
| |
| - | <tr class="tab_row_uneven"><td style="padding-left:3px;padding-right:3px"> <b>Sunset</b> </td><td style="padding-left:3px;padding-right:3px"> 6:30 PM </td><td style="padding-left:3px;padding-right:3px"> 7:30 PM </td><td style="padding-left:3px;padding-right:3px"> 2:30 </td></tr>
| |
| - | <tr class="tab_row_even"><td style="padding-left:3px;padding-right:3px"> <b>Midnight</b> </td><td style="padding-left:3px;padding-right:3px"> 7:00 PM </td><td style="padding-left:3px;padding-right:3px"> 8:00 PM </td><td style="padding-left:3px;padding-right:3px"> 3:00 </td></tr>
| |
| - | <tr class="tab_row_uneven"><td style="padding-left:3px;padding-right:3px"> <b>Sunrise</b> </td><td style="padding-left:3px;padding-right:3px"> 7:30 PM </td><td style="padding-left:3px;padding-right:3px"> 8:30 PM </td><td style="padding-left:3px;padding-right:3px"> 3:30 </td></tr>
| |
| - | <tr class="tab_row_even"><td style="padding-left:3px;padding-right:3px"> <b>Sunset</b> </td><td style="padding-left:3px;padding-right:3px"> 10:30 PM </td><td style="padding-left:3px;padding-right:3px"> 11:30 PM </td><td style="padding-left:3px;padding-right:3px"> 6:30 </td></tr>
| |
| - | <tr class="tab_row_uneven"><td style="padding-left:3px;padding-right:3px"> <b>Midnight</b> </td><td style="padding-left:3px;padding-right:3px"> 11:00 PM </td><td style="padding-left:3px;padding-right:3px"> 12:00 AM </td><td style="padding-left:3px;padding-right:3px"> 7:00 </td></tr>
| |
| - | <tr class="tab_row_even"><td style="padding-left:3px;padding-right:3px"> <b>Sunrise</b> </td><td style="padding-left:3px;padding-right:3px"> 11:30 PM </td><td style="padding-left:3px;padding-right:3px"> 12:30 AM </td><td style="padding-left:3px;padding-right:3px"> 7:30 </td></tr>
| |
| - | </table>
| |
| | | | |
| | One possible application for this function is to determine whether it's day- or nighttime. The following script simply uses the z-axis of the sun's vector to find out if the sun is above or below the horizon: | | One possible application for this function is to determine whether it's day- or nighttime. The following script simply uses the z-axis of the sun's vector to find out if the sun is above or below the horizon: |
Version du 16 octobre 2012 à 20:18
| Phase
| PST
| PDT
| GMT
|
| Sunset | 2:30 AM | 3:30 AM | 10:30
|
| Midnight | 3:00 AM | 4:00 AM | 11:00
|
| Sunrise | 3:30 AM | 4:30 AM | 11:30
|
| Sunset | 6:30 AM | 7:30 AM | 14:30
|
| Midnight | 7:00 AM | 8:00 AM | 15:00
|
| Sunrise | 7:30 AM | 8:30 AM | 15:30
|
| Sunset | 10:30 AM | 11:30 AM | 18:30
|
| Midnight | 11:00 AM | 12:00 PM | 19:00
|
| Sunrise | 11:30 AM | 12:30 PM | 19:30
|
| Sunset | 2:30 PM | 3:30 PM | 22:30
|
| Midnight | 3:00 PM | 4:00 PM | 23:00
|
| Sunrise | 3:30 PM | 4:30 PM | 23:30
|
| Sunset | 6:30 PM | 7:30 PM | 2:30
|
| Midnight | 7:00 PM | 8:00 PM | 3:00
|
| Sunrise | 7:30 PM | 8:30 PM | 3:30
|
| Sunset | 10:30 PM | 11:30 PM | 6:30
|
| Midnight | 11:00 PM | 12:00 AM | 7:00
|
| Sunrise | 11:30 PM | 12:30 AM | 7:30
|
One possible application for this function is to determine whether it's day- or nighttime. The following script simply uses the z-axis of the sun's vector to find out if the sun is above or below the horizon:
integer night=0; // 0 = daytime, 1 = nighttime
default
{
state_entry()
{
llSetTimerEvent(300); // Check every 5 minutes
}
timer()
{
vector sun = llGetSunDirection();
if (sun.z <= 0) night = 1; // Sun is below the horizon
else if (sun.z > 0) night = 0; // Sun is above the horizon
}
touch_start(integer total_number)
{
if (night == 1) llSay(0, "It's nighttime.");
else if (night == 0) llSay(0, "It's daytime.");
}
}
If the complete script is to behave different at night, an additional script state may be a better solution than checking a variable:
default // daytime state
{
state_entry()
{
llSetTimerEvent(180); // Check every 3 minutes
}
timer()
{
vector sun = llGetSunDirection();
if (sun.z < 0) state night;
}
touch_start(integer total_number)
{
llSay(0, "It's daytime.");
}
}
state night
{
state_entry()
{
llSetTimerEvent(180); // Check every 3 minutes
}
timer()
{
vector sun = llGetSunDirection();
if (sun.z > 0) state default; // Change back to daytime state
}
touch_start(integer total_number)
{
llSay(0, "It's nighttime.");
}
}
Rotating the object to follow the path of the sun during day time and return to a default position at night:
vector sun;
default
{
state_entry()
{
llSetTimerEvent(300); // Check every 5 minutes
}
timer()
{
vector sun = llGetSunDirection();
if (sun.z <= 0) { // If it is night, return to default position
llSetRot( <0, 0, 0, 0> );
} else if (sun.z > 0) {
rotation sunRot = ZERO_ROTATION; // Set the rotation to NULL
if (sun.z >= 0.0) { // If it is day, set rotation towards the sun
sunRot = llAxes2Rot(<sun.x, sun.y, 0.0>, <-sun.y, sun.x, 0.0>, <0.0, 0.0, 1.0>);
}
llSetRot(sunRot);
}
}
}
This can be used to quickly determine whether it is day or night (in shortened SL days) as the script runs: if the returned vector's Z element is positive, then the sun is above the horizon.
integer lightsOn = -1;//not TRUE or FALSE
CheckSun()
{
vector sun = llGetSunDirection();
integer turnLightsOn = (sun.z < 0);
if(turnLightsOn != lightsOn)
{
lightsOn = turnLightsOn;
llSetPrimitiveParams([ PRIM_FULLBRIGHT, ALL_SIDES, lightsOn ]);
}
}