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

Accueil > Blender > Scripts > Sun Engine - intégration du script

Sun Engine - intégration du script

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

the previous examples used one object (OBsun), and a second one for the text overlay (OBdate).
sundisplay told the script where to update the date and time display properties :

(interface is the name of the overlay scene)

the sun core object is the one with the script controler logic brick linked to sun_engine.py.
by default :

  • he is the object to move as the sun, (it is also the sun object)
  • it contains all the configuration, (it is also the sun configuration object)
  • it receives the current time properties (it is also the sun display object)

supposing you have an empty (OBconfig for example) that stores all the main variables of your game as properties, and you'd like to add the sun_engine properties to that empty :

  • select the sun core object,
  • in the logic panel, add the following property :
    . sunconfig (type:String)
    . in the text field type : the name of the scene where OBconfig is / the name of the object (Obconfig)

you can also separate the sun core object (the sun_engine script bricks) from the sun object :

  • select the sun core object,
  • in the logic panel, add the following property :
    . sun (type:String)
    . in the text field type : the name of the scene where OBsun is / the name of the object (Obsun)

here's the final setup of the sun core :

when the script initializes it looks for the sunconfig property and create sunconfigsc that stores the scene name, and sunconfigob that stores the object name. next times it will directly read the values from sunconfigsc and sunconfigob.
it does the same for sundisplay and sun : sundisplaysc, sundisplayob, sunsc, sunob. but it will store these properties in the sunconfigob object.
so you can act on these 6 properties to change the objects during the game, or you can change sun, sunconfig and sundisplay values then set suninit to True.

 



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