球体的使用
-
介绍
除了盒子,在三维场景中最常使用的形状便是球体了。我们可以利用三维物体组别中的添加球体编程积木来添加球体。
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/baea3367-6bb7-4950-b5b2-5f02b3676bb1.png" width="800" style="filter: drop-shadow(0.35rem 0.35rem 0.4rem rgba(0, 0, 0, 0.5));">
参数
颜色
你可以点击颜色输入框来设置球体的颜色。
x、y和z的大小
这三个数值控制了球体分别在每个方向的大小。举个例子,以下这个程序将会添加一个在z轴更长的椭圆球体:
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/906943dc-90fb-47ed-8654-6d17328f9cd1.png" width="800" style="filter: drop-shadow(0.35rem 0.35rem 0.4rem rgba(0, 0, 0, 0.5));">
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/a993d755-b8ef-4aac-b93a-58d38f13b166.gif" width="325" style="border-radius: 5px; border: 1px solid #29622d;">
弧度
“弧度”的数值让我们能够展示一个球体的一些部分,就好像你可以剥掉一个橙子的一些部分一样:
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/3c2d967d-0c24-46f5-9976-8e0e35e78443.png" width="300" style="border-radius: 5px; border: 1px solid #29622d;">
举个例子,下列这张动图就展示了弧度数值为100,75,50,25和5时,球体的差异:
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/d01ef4f6-4664-4f4b-a41d-692501b875dd.gif" width="700" style="border-radius: 5px; border: 1px solid #29622d;">
切层
”切层“数值让我们能垂直地切掉球体的一部分,这就好像你把柠檬切片一样:
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/ecae681f-afda-4269-95ec-169044bc2f06.png" width="400" style="border-radius: 5px; border: 1px solid #29622d;">
举个例子,下列动图展示了切层数值为100,75,50,25和5时,球体的差异:
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/8700dc2b-7b97-4463-98a1-e480c741606c.gif" width="700" style="border-radius: 5px; border: 1px solid #29622d;">
侧面数
一个球体是由很多个小三角形组成的,而“侧面数”决定了我们在创建球体时使用多少个三角形。侧面数数值越高,球体就看起来越光滑,但同时也会让游戏引擎花费更多时间来描绘这些三角形。举个例子,下列动图展示了侧面数数值为2,4,6,8,16和32时,球体的差异:
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/9982a997-3388-4a29-9b4a-973ce3955187.gif" width="700" style="border-radius: 5px; border: 1px solid #29622d;">
在多数情况下,你可以使用8个或16个侧面来减少运算。但当你要在场景中添加一个比较大的球体时,你会需要使用更多侧面来使它看起来光滑。演示
当你把弧度和切层数设置为小于100时,你将会得到一些有趣的形状。
举个例子,弧度为25以及切层数为50,你会得到一个飞天地毯:
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/fe6070f7-13ed-463f-aa76-268c730197b9.gif" width="250" style="border-radius: 5px; border: 1px solid #29622d;">
另一个例子,弧度为50以及切层数为25,你会得到一个面具:
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/5b4b92a9-7352-4a12-9228-47d043e45395.gif" width="250" 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