Turning a player in a certain direction?

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

PotatoGoesMoo

Member
Sep 1, 2017
20
0
0
Skript Version: Skript 2.2 (dev20c)
Skript Author: Bensku
Minecraft Version: 1.8.8 Spigot


Hi!

I want to know how to rotate a player in a certain direction, for example, this is what I'm looking for:

code_language.skript:
rotate the player 30 degrees sideways

Thanks!
~Potato:emoji_stuck_out_tongue:
 
Last edited:
Use expressions in the docs for setting player yaw and pitch to rotate someone visibly. You can also use packets, but I believe thats clientside.
 
directly setting the players yaw/pitch actually doesnt do anything. you have to set a variable to their location, set the location's pitch/yaw then teleport the player to the location
 
  • Like
Reactions: Wynnevir
directly setting the players yaw/pitch actually doesnt do anything. you have to set a variable to their location, set the location's pitch/yaw then teleport the player to the location
Thanks for the reply!
Sorry, I'm a little new to skript. I understand how to set a variable for a player's location, but how would i go about setting the pitch and yaw? Thanks!
 
If you're using Bensku's edit you can actually create a vector in a defined direction and then set the vector of the player to that.

code_language.skript:
set {_vector} to vector from player's location
rotate {_vector} around z-axis by 90 degrees #Pitch combined with x-axis aswell
rotate {_vector} around z-axis by 25 degrees #Yaw
set velocity of player to {_vector}
can also do this in 1 line aswell
code_language.skript:
rotate velocity of player around z-axis by 25 degrees
Vector stuff can be found here https://skripthub.net/docs/?search=vector
 
directly setting the players yaw/pitch actually doesnt do anything. you have to set a variable to their location, set the location's pitch/yaw then teleport the player to the location
oh, good to know. I had pulled that answer from the packets thread comment section
 
Status
Not open for further replies.