我正在使用AFrame,https://aframe.io/构建一个基本的Web应用程序。我正在尝试一个框架粒子组件,遵循这个例子,https://aframe.io/docs/1.3.0/introduction/entity-component-system.html#example。基本上,我复制了正式文档中提到的代码。
这是我的密码:
<html>
<head>
<script src="https://aframe.io/releases/1.3.0/aframe.min.js"></script>
<script src="https://unpkg.com/aframe-animation-component@3.2.1/dist/aframe-animation-component.min.js"></script>
<script src="https://unpkg.com/aframe-particle-system-component@1.0.x/dist/aframe-particle-system-component.min.js"></script>
<script src="https://unpkg.com/aframe-extras.ocean@%5E3.5.x/dist/aframe-extras.ocean.min.js"></script>
<script src="https://unpkg.com/aframe-gradient-sky@1.3.0/dist/gradientsky.min.js"></script>
</head>
<body>
<a-scene>
<a-entity id="rain" particle-system="preset: rain; color: #24CAFF; particleCount: 5000"></a-entity>
<a-entity id="sphere" geometry="primitive: sphere"
material="color: #EFEFEF; shader: flat"
position="0 0.15 -5"
light="type: point; intensity: 5"
animation="property: position; easing: easeInOutQuad; dir: alternate; dur: 1000; to: 0 -0.10 -5; loop: true"></a-entity>
<a-entity id="ocean" ocean="density: 20; width: 50; depth: 50; speed: 4"
material="color: #9CE3F9; opacity: 0.75; metalness: 0; roughness: 1"
rotation="-90 0 0"></a-entity>
<a-entity id="sky" geometry="primitive: sphere; radius: 5000"
material="shader: gradient; topColor: 235 235 245; bottomColor: 185 185 210"
scale="-1 1 1"></a-entity>
<a-entity id="light" light="type: ambient; color: #888"></a-entity>
</a-scene>
</body>
</html>当我在Chrome浏览器中运行我的应用程序时,我在控制台中得到以下错误,我看不到粒子。

我的代码有什么问题,我如何修复它?
发布于 2022-08-26 22:07:53
问题在于aframe-extras.ocean。它基于较早版本的aframe (和three.js),并使用在较新版本中已更改的mergeVertices函数。该错误破坏了应用程序的其余部分。
您可以将aframe版本降至0.9.0,也可以将aframe-extras.ocean进行分叉和更新。我通常建议您向aframe-附加程序的维护人员报告这一点,但是他们可能不够活跃,无法及时修复它。
https://stackoverflow.com/questions/73506801
复制相似问题