如何在随机位置生成多个球体 [a-frame]
How can I spawn multiples spheres at random positions [a-frame]
在 aframe
我想生成 sphere
100 次,每次都是随机的 position
首先,position= "x y z"
中的每个值都应该是 -100 到 100 之间的数字
<a-sphere
position="x y z"
radius="0.5">
</a-sphere>
其次,上面的代码应该重复 100 次,不影响前面的 sphere
。
这是想要的end result,忽略动作。
如何实现?
参见:
- http://ngokevin.github.io/kframe/components/entity-generator/
- https://ngokevin.github.io/kframe/components/randomizer/
使用实体生成器 + 随机化器组件。
<a-mixin id="sphere" geometry="primitive: sphere" material random-position="min: -100 -100 -100; max: 100 100 100"></a-mixin>
<a-entity entity-generator="mixin: sphere; num: 100"></a-entity>
在 aframe
我想生成 sphere
100 次,每次都是随机的 position
首先,position= "x y z"
中的每个值都应该是 -100 到 100 之间的数字
<a-sphere
position="x y z"
radius="0.5">
</a-sphere>
其次,上面的代码应该重复 100 次,不影响前面的 sphere
。
这是想要的end result,忽略动作。
如何实现?
参见:
- http://ngokevin.github.io/kframe/components/entity-generator/
- https://ngokevin.github.io/kframe/components/randomizer/
使用实体生成器 + 随机化器组件。
<a-mixin id="sphere" geometry="primitive: sphere" material random-position="min: -100 -100 -100; max: 100 100 100"></a-mixin>
<a-entity entity-generator="mixin: sphere; num: 100"></a-entity>