# Turning a player in a certain direction?

Discussion in 'Skript' started by PotatoGoesMoo, Dec 19, 2017.

Not open for further replies.
1. ### PotatoGoesMoo Member

Joined:
Sep 1, 2017
Messages:
20
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 (Skript):
1. rotate the player 30 degrees sideways
Thanks!
~Potato

#1
Last edited: Dec 19, 2017
2. ### Wynnevir Well-Known Member

Joined:
Jul 9, 2017
Messages:
1,016
62
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.

#2
3. ### Donut Well-Known Member

Joined:
Mar 27, 2017
Messages:
1,340
176
Medals:
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

#3
• Like x 1
4. ### PotatoGoesMoo Member

Joined:
Sep 1, 2017
Messages:
20
0
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!

#4

Joined:
Jan 24, 2017
Messages:
622
438
Medals:
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 (Skript):
1. set {_vector} to vector from player's location
2. rotate {_vector} around z-axis by 90 degrees #Pitch combined with x-axis aswell
3. rotate {_vector} around z-axis by 25 degrees #Yaw
4. set velocity of player to {_vector}
can also do this in 1 line aswell
Code (Skript):
1. rotate velocity of player around z-axis by 25 degrees
Vector stuff can be found here https://skripthub.net/docs/?search=vector

#5
6. ### Wynnevir Well-Known Member

Joined:
Jul 9, 2017
Messages:
1,016
62

#6
Not open for further replies.