Solved camera following player

Discussion in 'Plugin Development' started by LIMPIX31, Jul 15, 2021.

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

    LIMPIX31

    how can I make it so that the player's camera is always turned to another player, it is desirable that the camera rotation is smooth
     
  2. Offline

    timtower Administrator Administrator Moderator

    @LIMPIX31 Don't think you have that amount of control with plugins. Only with mods.
     
  3. Offline

    reghzyTheR

    from what i remember, the Location class can alter the player's yaw and pitch. so you could do some rotation math based on the location of the other player to calculate the yaw and pitch, and then set your location as that new location to apply the rotation

    and if you want it constantly looking, you could use bukkits scheduler and run that code every few ticks
     
  4. Offline

    timtower Administrator Administrator Moderator

    Could, but would it be smooth enough and still let the player do everything?
     
  5. Offline

    LIMPIX31

    I'm not very good at mathematics, could you tell me what I need to do for this.

    Perhaps there is some kind of packet for smooth camera rotation?
     
  6. Offline

    KarimAKL

    @LIMPIX31 There is no need to mess with the yaw and pitch yourself. I answered how to make a player look at another player in this post.
     
  7. Offline

    LIMPIX31

    Thanks, this works as I need it, now I'm going to check the smoothness.

    EDIT:
    I made not another player follow the player, but the armor stand, and then put the player in spectator mode and made the armor stand watch and it looks smooth.

    CLOSED (I will attach the code here soon)
     
    Last edited: Jul 16, 2021
Thread Status:
Not open for further replies.

Share This Page