Initializing a 3D Scene
-
A 3D “scene” is similar to a 2D “stage” in Scratch. It is a pre-built 3D virtual world with some background, objects, lighting, and cameras, so you just need to add new objects/characters specific to your project into this world. For example, a “city” scene may contain buildings and roads.
Key Block 1
-
Scene Name: By default, an “Empty” scene will be loaded with no objects in it. You can select a different scene by clicking the “Empty” input field, which will pop up a library window for you to browse and select a new scene. All available scenes: Empty, Blue Sky, Castle, City, Classroom, Earth, Solar System, The Moon, Moon Surface, Mars Surface, Mars Geography Map, Mars Geography Map with Names, Garden, Globe, Earth Geography, Globe in Chinese, Globe in Chinese (more labels), Grass Land, House, School, Soccerfield, Street, Underwater, Village, Human Body, World Map, USA Map, Vietnam Map.
-
Hidden Mode: By default, the scene is visible when it is created. You can set it to be hidden instead by selecting “yes”. The scene will still be downloaded and constructed, but it will not be rendered in the stage window. To reveal the scene later, you can use the show 3D scene block described below.
Behavior
When running this block, the 3D scene’s data will be downloaded into your browser, converted into 3D objects, and then rendered on the stage window. Larger scenes, such as the “city” scene, will take longer to prepare compared to simpler scenes like the “grass land” scene.
Program execution will pause at this block, and continue to the next block only after the scene is completely rendered.
If the “Empty” scene is loaded, it will not contain any object, but it does contain a dark blue background, a 3D camera, and some sunlight.
Never initialize the 3D scene more than once
In almost all scenarios, you should only initialize the 3D scene once. For example, if you initialize the 3D scene 2 times, then the second time you do it, the existing 3D scene and all the objects in it will be removed.
Example
Program:
Output:
Key Block 2
- Visible Mode: If “yes”, then the 3D scene will become visible; if “no”, then the 3D scene will be hidden.
Behavior
When running this block, the 3D scene will become visible or hidden immediately. This is useful if you want to hide the 3D scene initially and reveal it later. You may also use this block to hide the 3D scene and display the 2D stage instead.
Example
Program:
Output:
Run it yourself:
https://play.creaticode.com/projects/a288e7d0063ff84a45e66da5
Demos
Build and run your first 3D program:
Change the size of the 3D window:
See Also
-
-
-