Dynamically spawned physics objects with collision #4104
-
Hi! We're building a custom hubs-cloud client and we'd like to dynamically spawn physics objects that collide with the ground and with one another. We're currently spawning physics objects as follows: const ent = document.createElement("a-entity");
ent.setAttribute("networked", "template:#spawnedObj-drawing");
ent.setAttribute("body-helper", {
collisionFilterMask: -1,
gravity: {x: 0, y: -9.8, z: 0}
});
APP.scene.appendChild(ent); ...using the following template: <template id="spawnedObj-drawing">
<a-entity class="spawnedObj" geometry="primitive:sphere"></a-entity>
</template> ...but these spawned objects fall through the environment and don't collide with one another, even though Are we missing something about how the Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yes, you will need |
Beta Was this translation helpful? Give feedback.
Yes, you will need
body-helper
andshape-helper
along with probably several more things to get the objects to behave as intended. I don't have any documentation on the physics system to point you to. The best resource we have for this is guide: Creating New Networked Interactables