Get location of player's hands

Discussion in 'Spigot Plugin Development' started by Ward1246, Jun 14, 2018.

  1. Hello! I know this is a very odd question, but what are some methods to get the locations of the player's hands? The problem is when the player rotates, their body does not rotate until their head rotation gets too far away from the body's rotation. I was just wondering if there is any way to guarantee that I have the player's hand rotation? I am trying to display particles at their hands is why, if they rotate too far without the body updating its just 2 random floating particle spots. Thanks for any help on this rather strange issue!
     
  2. I don't think this is possible.
     
  3. I don't think there is a good way to do it where it would be 100% accurate.

    Code (Java):

    public static Location getRightSide(Location location, double distance) {
        float angle = location.getYaw() / 60;
        return location.clone().subtract(new Vector(Math.cos(angle), 0, Math.sin(angle)).normalize().multiply(distance));
    }

    public static Location getLeftSide(Location location, double distance) {
        float angle = location.getYaw() / 60;
        return location.clone().add(new Vector(Math.cos(angle), 0, Math.sin(angle)).normalize().multiply(distance));
    }
    This might work but like I said it would not be 100% accurate.
     
    • Agree Agree x 1
  4. I'm not certain it is either, figured I should ask here first before giving up on it lol.

    I will have to try this out and see if I can adjust it any way I can, possibly with the below idea, thank you!

    I couldn't think of anything besides testing PlayerMoveEvents and seeing if the player changed their rotation enough. Haven't tried it but I will see what I can do.

    EDIT: Currently experimenting with setting a shoulder entity and getting its location, would work perfect if I can get it to function. Result: Looking into the API, and trying my own things conclude that this will not work. This will not currently work due to the entity being set on the shoulder is a clone, and the actual entity does not update. I tried using the #getLeftShoulderEntity (might be a different name, but same idea) to try getting the clone, but that did not seem to provide a location I could use. Even tried an actual parrot (API and my testing confirms currently the entity will not render unless it is a parrot.)

    Edit2: I have not tried very hard, but testing for PlayerMoveEvents does not seem to be useful, due to all the inaccuracies it will have.

    Edit3: There is one way in which this will work - forcing the body rotation to update though an animation packet. This does force the players arm to swing, which is undesirable. I could not get rotation based testing to work due to how inaccurate it was.
     
    #4 Ward1246, Jun 14, 2018
    Last edited: Jun 15, 2018
    • Informative Informative x 1

Share This Page