sun_angle
Euler angle containing the azimuth (0...360, default 0)
and elevation (0..90, default 30)
of the sun. Is set to the map properties on level loading
(level_load)
,
and can be changed during gameplay. Determines the light direction for
the shading of flat textures, for the gouraud shading of models, and
for dynamic shadows.
Range:
sun_angle.pan
0 .. 360 (default: 0)
sun_angle.tilt 0 .. 90
(default: 30)Type:
VECTOR
Remarks:
-
The sun_pos vector is calculated from the pan and tilt angles given here, and a distance given by the sun_angle.roll component
(default: 50000).
-
The
angle of a sun ray
is vector(sun_angle.pan+180,-sun_angle.tilt,0).
Example:
The following
code simulates the sun path over the sky, f.i. for a role playing
game with day and night.
function sun_move()
{
while(1)
{
sun_angle.pan += 0.01 * time_frame;
sun_angle.pan %= 360;
sun_angle.tilt = fsin(sun_angle.pan, 45) + 45;
sun_light = sun_angle.tilt;
wait(1);
}
}
See also:
sun_pos, sun_light,
sun_color
► latest
version online