ArmorStand stutters

Discussion in 'Spigot Plugin Development' started by FrostedSnowman, Apr 14, 2017.

  1. FrostedSnowman

    Resource Staff

    why does this happen RANDOMLY when i am setting the yaw? the armorstand's yaw changes smoothly but then it randomly starts to stutter then it'll randomly fix itself, or not at all sometimes..

    here's what i mean: http://i.imgur.com/hek3run.gif
    [​IMG]

    (sorry if its not the best, and pardon the lag. you can see the stutter/flicker a little at the beginning. it only gets worse**at times**



    current code:
    Code (Java):

    //im already setting the yaw to 0, before all this
    if (armorStand.getLocation().getYaw() < 360) {
        yaw = armorStand.getLocation().getYaw();
        yaw+=10;
        Location loc = new Location(armorStand.getWorld(), armorStand.getLocation().getX(), armorStand.getLocation().getY(), armorStand.getLocation().getZ(), yaw, armorStand.getLocation().getPitch());
        armorStand.teleport(loc);
        return;
    }
    yaw = 0;
    Location loc = new Location(armorStand.getWorld(), armorStand.getLocation().getX(), armorStand.getLocation().getY(), armorStand.getLocation().getZ(), yaw, armorStand.getLocation().getPitch());
    armorStand.teleport(loc);
     
    how can i fix this?

    EDIT: here's a better 'stutter' example:
    https://gyazo.com/a06b6ee0c82d846176fc4fc3563e0c8a
     
    #1 FrostedSnowman, Apr 14, 2017
    Last edited: Apr 14, 2017
  2. What kind of task are you running this in?
     
  3. FrostedSnowman

    Resource Staff

    im using a bukkittask/runnable

    Code (Java):

    new BukkitRunnable() {
         run ...
    }
     
  4. Try on async changing a variable and another task on sync implementing that variable to the armorstand?
     
  5. FrostedSnowman

    Resource Staff

    alright. i'm currently running all of the calculation stuff and adjustments to the armorstand, async
     
  6. Hmm, thats really odd. usually async tasks run very smooth.
     
  7. FrostedSnowman

    Resource Staff

    still doesn't work. i tried running it all in a sync task(didnt expect a different outcome) any other thoughs/solutions??
     
  8. Increment a Delta? So calculate how long each loop takes and change the var depending on the Delta.
     
  9. FrostedSnowman

    Resource Staff

    interesting idea, however, im not sure it should be this 'complicated.' i feel like this is more of a 'bug' or thing that can fixed and still use the method im using.