Initializing a 3D Scene
CreatiCode last edited by info-creaticode
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.
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.
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.
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.
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.
- Visible Mode: If “yes”, then the 3D scene will become visible; if “no”, then the 3D scene will be hidden.
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.
Run it yourself:
Build and run your first 3D program:
Change the size of the 3D window: