Day and Night Cycle
For the python city to create a day and night cycle I wanted to use a a direction light so that when it moves it looks like the sunlight moves away and the darkness of light follows. So my initial idea was generate a light source and key it turning so that it looked like the sun and night going clockwise around the city.
Once I had the idea established I ended up with this piece of code:
#Day and Night Cycle creation using a directional light with it turning clockwise and keying it every few frames to create the turning motion.
light = cmds.directionalLight(i = 10)
for i in range(25):
cmds.currentTime( i*15, edit=True )
cmds.setKeyframe("directionalLight1",v=i*15, at="rotateX")
This piece of code allows me to generate a directional light and set it to spin clockwise five times to replicate a constant day to night throughout the entire city which properly illuminates the city.
Programming for Computer Animation and VFX - Maya Python City
Status | Released |
Author | Aronne_Monk |
More posts
- FunctionsApr 24, 2023
- UI (Buttons & Sliders)Apr 24, 2023
- BuildingsApr 24, 2023
- Snow SimulationApr 24, 2023
Leave a comment
Log in with itch.io to leave a comment.