City Timelapse
This is my attempt at making a city timelapse in Tinkercad using codeblocks.
View the file here: https://www.tinkercad.com/codeblocks/bFQJamN7zXD
Supplies
A Tinkercad account.
Use the bite sized tutorials available in tinkercad if you've never used the program before.
Expectations + Some Limitations
I was expecting to make buildings with individual blocks, which would change colour at night, giving the illusion of lights being switched on, have realistic shadows using "flat cubes" which would change shape...
That would be hard....
But, it turns out, tinkercad can't handle a lot. You are confined to a cube of volume 200*200*200 units as your workspace.
200 is the limiting number. You can't have more than 200 objects, iterations...etc
This is mainly a demonstration that a bit of coding combined with 3d designs is quite powerful.
Creating Buildings-1
We are gonna use a loop to create how many buildings we want.
Adding the <add cube> inside the loop would create those many buildings.
Creating Buildings-2
But we don't want the buildings to be same.
That's where the random number generator comes in. It outputs a number within the defined boundary conditions.
So, we will add random numbers as the dimensions of our box, within reasonable limits, that is.
This would create seemingly random structures, but they would be stacked at the origin.
Creating Buildings-3
To separate the buildings from each other, we will move every cube after altering its dimensions.
This movement has to be random too, so the buildings are evenly spread out in the x-y plane.
We will use the random number generator again, this time to move along the x and y axes. The z axis should be 0, because we don't want floating buildings (or do we, future??).
Limits: x: -100 to 100
y: -100 to 100
These are the maximum tinkercad can handle. Keep the range shorter.
Creating Buildings-5
The buildings stick out in the -z axis.
We will delete that portion.
Add a cube which spans the whole x-y plane and half the z axis.( 100*100*50) and move it down by -50 in the z axis. Make it a instead of a and group the objects together.
As you saw in the second image, the whole portion didn't get deleted. So I made the span of the buildings shorter.
Creating the Sky-1
The sky is a dome. The buildings sit in the interior. I reduced the span of the buildings even more so the sphere comfortably engulfs the whole scene.
Creating the Sky-2
As we zoom inside the sphere, the colour disappears and the interior looks white. That is because the sphere is solid, and not hollow. To make it coloured on the inside, scour a portion using a spherical hole.
Creating a Base
A simple cube with low height but streched to fill the entire x-y plane.
Combining Everthing-1 (Base, Buildings)
We are going to combine the buildings and the base as one object.
Combining Everything-2 (Sky)
We are going to create a new object, for the sky, so the buildings and the base don't affect it.
Making the Sky Change Colour.
Under the object associated with sky, inside a loop, put the <change colour> modifier.
To hold the longer, use more <set colour> modifiers for the desired colour.
Finished Timelapse, Feedback for Tinkercad
I really wanted to put a sun and stars in the sky which would rotate while the sky changed colour. This wasn't possible because tinkercad does things one after the other, instead of doing them simultaneously. It would be lovely to have a feature which allows us to define the order of execution for multiple objects.