Created
March 2, 2021 12:26
-
-
Save BABAK0T0/0a073bad5746ca3f081cf0aa8f5d1d43 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const objs = new THREE.Group(); | |
| const minRadius = 3; | |
| const maxRadius = 6; | |
| for(let i = 0; i < 50; i++) | |
| { | |
| const angle = Math.random() * Math.PI * 2; // Random angle | |
| const radius = minRadius + Math.random() * maxRadius; // Random radius between [3,9] | |
| const x = Math.cos(angle) * radius; // Get the x position using cosinus | |
| const z = Math.sin(angle) * radius; // Get the z position using sinus | |
| // Create the mesh | |
| const mesh = new THREE.Mesh(objGeometry, objMaterial); | |
| // Position | |
| mesh.position.set(x, 0, z); | |
| // Add to the graves container | |
| objs.add(mesh) | |
| } | |
| scene.add(objs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment