创建三维场景
-
3D“场景”类似于 Scratch 中的 2D“舞台”。它是一个预先构建好的 三维虚拟世界,其中包括了背景幕布、各类物体、灯光和摄像头。例如,“城市”这个场景已经包含了一个小城市的建筑物和道路。
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/08efb88c-549e-4a31-bc43-9fb39d1e422d.png" width="700" style="">
创建三维场景积木
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/e9b9d412-bb62-4421-ac87-3a8c92ccc606.png" width="400" style="">
-
场景名称:默认情况下,“空”场景将被选择,其中没有任何物体。你可以通过单击“空”输入字段来选择不同的场景,这将弹出一个库窗口供你浏览并选择一个新场景。
-
是否隐藏:默认情况下,场景在创建时是可见的。你可以通过选择“是”将场景设置为隐藏。这样场景仍将被下载和构建,但当时不会立即在舞台窗口中被显示出来。此后任何时间要想再次显示场景,你可以使用下面介绍的显示3D场景 块。
运行效果
运行这个积木块时,3D场景的数据将下载到你的浏览器,转换为3D物体,然后在舞台窗口上显示出来。与“草原”场景等较简单的场景相比,“城市”场景等较大的场景需要更长的准备时间。
程序执行将在该块暂停,只有在场景完全渲染后才能继续执行下一个块。
如果加载“空”场景,它将不包含任何物体,但它确实包含深蓝色背景、3D 摄像头和一些阳光。
示例程序
程序:
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/9038197c-bbf7-4218-bfda-5460fe89c480.png" width="400" style="">
输出:https://cdncreaticodecom.b-cdn.net/awsuploads/947564/images/9217319/grass1.gif" width="400" style="border-radius: 5px; border: 1px solid #29622d;">
显示三维场景积木
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/25608b18-618e-45bf-a6ef-4221add95ec1.png" width="250" style="filter: drop-shadow(0.35rem 0.35rem 0.4rem rgba(0, 0, 0, 0.5));">
- *可见模式 *:如果选“是”,则3D场景将变为可见;如果选“否”,则3D场景将被隐藏。
运行效果
运行此积木块时,3D场景将立即变为可见或隐藏。如果你想先隐藏3D场景然后再显示它,这个积木块也很有用。另外你也可以使用此块隐藏3D场景,并改为显示2D舞台。
示例
程序:
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/4ea316f2-491a-46f5-8ed0-e9f097513191.png" width="350" style="">
输出:
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/67f3e159-067e-46a0-8e88-e50b7606632a.gif" width="400" style="border-radius: 5px; border: 1px solid #29622d;">
演示
创建并运行你的第一个3D程序:
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/426c5e2e-0a20-494a-8d3e-0ba06ba752fb.gif" width="1000" style="border-radius: 5px; border: 1px solid #29622d;">
更改 3D 窗口的大小:
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/c69549e8-8707-4971-852f-4580971101ff.gif" width="1000" style="border-radius: 5px; border: 1px solid #29622d;">
另请参见
-
-
I CreatiCode pinned this topic on
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login