Skip to content

Commit

Permalink
Tweaks to physics cluster example
Browse files Browse the repository at this point in the history
  • Loading branch information
willeastcott committed Feb 7, 2025
1 parent 14b4f37 commit eb4ed6b
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions examples/physics-cluster.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@
<pc-asset src="assets/skies/octagon-lamps-photo-studio-2k.hdr" id="studio"></pc-asset>
<pc-asset src="assets/scripts/gravity.mjs"></pc-asset>
<pc-asset src="assets/scripts/physical-pointer.mjs"></pc-asset>
<pc-material id="hotpink" diffuse="hotpink"></pc-material>
<pc-material id="mediumseagreen" diffuse="mediumseagreen"></pc-material>
<!-- Scene -->
<pc-scene gravity="0 0 0">
<!-- Sky -->
<pc-sky asset="studio" type="none" lighting></pc-sky>
<!-- Camera -->
<pc-entity name="camera" position="0 0 5">
<pc-camera clear-color="#cccccc" tonemap="neutral"></pc-camera>
<pc-camera clear-color="lightgray" tonemap="neutral"></pc-camera>
</pc-entity>
<!-- Physical Sphere Template -->
<template id="sphere-template">
Expand Down Expand Up @@ -69,10 +68,8 @@
const sphereEntity = clone.querySelector('pc-entity');

// Set a random start position
const x = (Math.random() - 0.5) * 10;
const y = (Math.random() - 0.5) * 10;
const z = (Math.random() - 0.5) * 10;
sphereEntity.setAttribute('position', `${x} ${y} ${z}`);
const rnd = (max) => (Math.random() - 0.5) * max;
sphereEntity.setAttribute('position', `${rnd(10)} ${rnd(10)} ${rnd(10)}`);

// Append the clone to the scene
scene.appendChild(clone);
Expand Down

0 comments on commit eb4ed6b

Please sign in to comment.