How could I create a sphere shape with random x,y,z coords?

Started by Litleck on

Topic category: Advanced modding

Last seen on 14:19, 15. Sep 2018
Joined May 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How could I create a sphere shape with random x,y,z coords?

Hello,

So I have created this function which randomly places a block in a specified range.

Procedure

 

 

 

 

This gets blocks randomly placed in a cube of 4 blocks away from the center point.  How would I be able to modify this so that it'll form a sphere?  I would need to use sin, cos and maybe some tan? 

All help will be appreciated.

Last seen on 17:17, 10. Jan 2024
Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The easiest way is iterating…
Sat, 06/30/2018 - 19:01

The easiest way is iterating a cube (centered to the center of the sphere) that has the length of a side two times bigger than the radius of the sphere, and checking for each block in the cube if its distance from the center is less or equal to the radius.

Last seen on 14:19, 6. Aug 2021
Joined Jul 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Wouldn't it just be easier…
Mon, 07/02/2018 - 04:43

Wouldn't it just be easier to create a schematic of a sphere thing & then just use the "Place schematic" button?

You can use the loop blocks…
Mon, 07/02/2018 - 08:22

You can use the loop blocks in MCreator to achieve this the way Nuparu suggested.