Solved Creating circle

Discussion in 'Plugin Help/Development/Requests' started by I Al Istannen, Jun 15, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    I Al Istannen

    Hey,
    I have been struggeling lately with creating an circle with armorStands. Yes, I know that circles are evil :) So I have this code:
    Code:
    new BukkitRunnable() {
    
       int i = 0;
        
       @Override
       public void run() {
         i = i + 1;
         if(i < 360) {
           System.out.println("Running: " + i);
           double alpha = i; // setting angle
                    
           double stick2X = Math.cos(r(alpha)) * 0.8; // getting x cooridinate with an offset of 0.8
           System.out.println("Stick2X: " + stick2X);
           double stick2Z = Math.sin(r(alpha)));
           System.out.println("Stick2Z: " + stick2Z);
    
           stick2.teleport(e.getPlayer().getLocation().add(stick2X, -1, stick2Z));
        
           ArmorStand st = (ArmorStand) w.spawnEntity(stick2.getLocation(), EntityType.ARMOR_STAND);
           st.setGravity(false);
           st.setCustomName("" + i);
           st.setCustomNameVisible(true);
        
         }
         else {
           super.cancel();
         }
       }
    }.runTaskTimer(this, 20L, 1L);
    
    Where r(double) just converts to radian. "stick2" is an pre spawned armorstand. The output is like this:
    [​IMG]

    This is sadly an ellipse and not a circle. Do you have any ideas why?

    EDIT: Hit me, I'm an idiot -.- I added an offset of 0.8 to the x coordinate and expected an circle. Thank god I added comments to post it here and spotted this. It is working now.
     
Thread Status:
Not open for further replies.

Share This Page