ArmorStand passenger rotation

Discussion in 'Plugin Development' started by Dark_Narcosis, Feb 20, 2020.

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

    Dark_Narcosis

    Currently i am attempting to make vehicles on my server. I'm spawning an armor stand with a remodeled block on its head, this is riding a player and the player is riding a horse.

    I'm using a horse as i wanted to player to have WASD controls on the vehicle and i couldn't quite crack how to make a custom entity that a player can control. Before i used horses i had the player riding an armor stand and i would repeatedly set its velocity to where ever the player was looking, this didn't give the player much control over the vehicle.

    The current problem is that i cant seem to make the head of the passenger armor stand face the same direction as the player. It will either lag behind where the player has to turn a certain amount before the armor stand starts to follow, or it will jump randomly to face the opposite direction.

    I have tried using setRotation and EulerAngles but with no luck.
    Code:
    float degrees = (player.getLocation().getYaw()+180) % 360;
                    ArmorStand as = (ArmorStand) player.getPassenger();
                    as.setRotation(degrees, 0);
    Any help would be appreciated :) , (ps if you know how to create an armorstand that a player can control with WASD any help would be amazing).
     
Thread Status:
Not open for further replies.

Share This Page