1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Turning a player in a certain direction?

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

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

    PotatoGoesMoo Member

    Joined:
    Sep 1, 2017
    Messages:
    20
    Likes Received:
    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:emoji_stuck_out_tongue:
     
    #1 PotatoGoesMoo, Dec 19, 2017
    Last edited: Dec 19, 2017
  2. Wynnevir

    Wynnevir Well-Known Member

    Joined:
    Jul 9, 2017
    Messages:
    1,016
    Likes Received:
    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.
     
  3. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    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
     
    • Like Like x 1
  4. PotatoGoesMoo

    PotatoGoesMoo Member

    Joined:
    Sep 1, 2017
    Messages:
    20
    Likes Received:
    0
    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!
     
  5. LimeGlass

    VIP Supporter Addon Developer

    Joined:
    Jan 24, 2017
    Messages:
    622
    Likes Received:
    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
     
  6. Wynnevir

    Wynnevir Well-Known Member

    Joined:
    Jul 9, 2017
    Messages:
    1,016
    Likes Received:
    62
    oh, good to know. I had pulled that answer from the packets thread comment section
     
Thread Status:
Not open for further replies.

Share This Page

Loading...