Hey, I am currently working on my project but my question is: is there a way to rotate the player view smooth? Instead of teleporting him too the same location and changing the pitch/yaw. Because it little bit rough? I have thinking if it is possible with velocity? for the head rotation. My character will not move only his head will be rotating around (the player should not be enable to move at that moment) so the head rotation has to come from the plugin.
Assuming you're using NMS, isn't there https://github.com/Bukkit/mc-dev/blob/master/net/minecraft/server/PacketPlayOutEntityLook.java and https://github.com/Bukkit/mc-dev/bl...t/server/PacketPlayOutEntityHeadRotation.java? EDIT: I misunderstood, you probably aren't using NMS, but this would still probably be the best way to do it
Try using ProtocolLib, assuming you are new with packets. Do you know how the ProtocolLib dependancy works? Send packets to the player, so you can have your plugin not dependant, so you can do this without NMS.
I quickly just researched and found this about Vectors https://www.spigotmc.org/threads/tutorial-vector-for-beginners.68194/
I am not new with packages I will show you what my problem is with this video I want to get a smooth rotation on the same location (the vector post didn't help me because I know how to get the vector of the direction but if I add it to the players location it doesn't do anything
When you use the teleport function for the player class just change the yaw/pitch of the location you are teleporting to the player's current yaw/pitch.
Code (Java): for (Player p : camera.getConnected()) { if (p != e.getPlayer()) { p.teleport(e.getPlayer()); } } but this is in a player move event and maybe you know but a player move event won't be triggered by every movement of a player only a x amount of change will update it for the movement event. Edit: packets won't be a good option (personally I think) they are for myself less stable and I don't want too use outside plugins like protocollib because it has to be a standalone plugin
Wha.. what are you talking about? His problem is not related to packets at all. You can try to use additional entity. Make player sit on it or enforce player to spectate this entity. Instead of teleporting player around - teleport entity.
Spectating isn't also not a option has to be in survival, I have think and used a way to change the view of the player in the armorstand but that doesn't work if the armorstand is outside of your view side.
And protocollib is not the only library for packets. Use NMS if you wished or tinyprotocol(inside your project), but give credit.
The only thing that I need is a smooth rotation from pitch/yaw 1 to pitch/yaw 2. And has to get from a player movement event because all players in the list has to follow what player1 sees
Oh, hm... I understand what you want now. I didn't really understand what you are tryna make. So a 1st person spectator. You want it to be smooth for the players.
There's no options then. Minecraft is not friendly to this kind of things, and the only option is to use another entity(or use modified client, idk), because client smoothing movement of other entities but not own. That's all.
They are viewing what a users sees and that user is controlling a armorstand that is looking at that direction what the 'main' player is watching too. And now the spectators has to see the same but in survival
The only way that I can think is setting the view on the armorstand itself after I teleported him in the armorstand so the view distance will be the same. So that must be packets without it, its impossible what you are saying