http://jerome.le.chat.free.fr

Accueil > Blender > Scripts > Sun Engine - configurer la date et l'heure

Sun Engine - configurer la date et l'heure

Index de l'article
Sun Engine
latitude et longitude
configurer la date et l'heure
vitesse de révolution du soleil
configuration avancée
modifier la vitesse de révolution du soleil pendant le jeu
afficher la date et l'heure dans le jeu
intégration du script
mécanisme alternatif pour la position du soleil
réference des objets et des propriétés

by default the current time (youx box time) is used. now we'll specify the starting date and time :

  • select your sun object,
  • in the logic panel, add the following properties :
    . year (type:int)
  • start the G.E.

the animation starts the 1st january of the configured year

 

we now specify an accurate date and time :

  • select your sun object,
  • in the logic panel, add the following properties :
    . month (type:int)
    . day (type:int)
    . hours (type:int)
    . mins (type:int)
    . secs (type:int)
    . TZ (type:int) : the timezone of the location. only used for display, add your local time in the other fields.
    . DST (type:int) : daylight saving time
  • start the G.E.

guess what

 

if one of the argument is missing, the script will start the 1st january.
date and time must belong to the interval 1st january 1970, 01:00:00 and 1st january 3001, 08:59:59


ok. but now I want to use my computer date/time back as a starting date :

  • select your sun object,
  • in the logic panel, add the following property :
    . uselocaltime (type:Bool)
  • set it to True
  • start the G.E.

we now use the local time again


you can also specify the date in the python time() format - in seconds since the epoch :

  • select your sun object,
  • set uselocaltime to False,
  • in the logic panel, add the following property :
    . startSecs (type:string)
  • in the text field type 946681200
  • optionaly you can delete year, month, day, hours, mins and secs
  • start the G.E.

Blender console says : Saturday 01 January 2000 - 00:00:00

startSecs can be useful to switch the sun from one date to another one (see advanced).
uselocaltime can be toggled during the game with a keyboard sensor for example, so the sun will switch from the local time to the configured starting time.
the uselocaltime property can be used alone, you don't need to specify a date, it can be added during the game.
in the Blender console, the very first lines display the starting time and the corresponding value in seconds since epoch, you can copy/paste this value and use it in the startSecs property.




Mise à jour le Vendredi, 23 Octobre 2009 14:20