[TUTORIAL] Circles, Cylinders, Spheres, etc.

Started by Mindthemoods on

Topic category: User side tutorials

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[TUTORIAL] Circles, Cylinders, Spheres, etc.

Found a lot of less-than-helpful advice for this topic while looking for solutions, so no point beating around the bush, here's the procedure you'll need for a sphere:

Sphere function

The basic idea is that the first loop does a 180-degree rotation on the y axis, and at each increment creates a circle. (Using a 360 degree rotation on the x/z axis). This procedure just places the desired block at each position, but you can customize this to do basically anything. (Adding +0.5 centers the sphere on the middle of a block, instead of its bottom corner, but might be unessesary depending on your needs.)

A circle is much simpler, and you can of course create cylinders by stacking these on top of each other:

In both examples, the radx/rady/radz variable allow you to scale the shape in each axis. (making an oblong circle/sphere.) A rady value of 2 would make your sphere twice as high as it is wide, and a value of 0.5 would make it half as high as wide. (Though you will begin to have missing chunks if the variable is too far above 1, so generally just increase radius and use fractional values for scaling.)

To do filled spheres/circles, you can just repeat the process with a smaller radius. (That is, do a x10 repeat creating a sphere with radius 10, decreasing the radius by 1 each loop.) 

Lastly, keep in mind this is a bit resource intensive- checking every degree is probably a little overkill, but as long as you're not running it every tick, it's probably fine. (Though alternatively, if you want REALLY big shapes for some reason, you would probably need to increment your degrees by fractional values.) The procedures+ plugin has a similar system, but I've found this method gives much greater control if you need this for terrain features and whatnot. Hope this helps! 

Joined Jun 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hi, do you have any idea how…
Mon, 03/24/2025 - 04:32

Hi, do you have any idea how to apply this procedure to an entity tick update with a push procedure to make the entity move in a circle? I've tried this procedure, but to no success, as the entity just moves off in a straight line at very fast speeds.