Binding pitch and camera angle

  • 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 community!

    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!

tatarararat

New Member
Feb 13, 2023
7
0
1
I want to make something like a flute that changes its tone from 0.5 to 2 depending on the player's camera angle

Code:
on rightclick with echo shard:
    set {_pitch} to player's pitch
    set {angle} to {_pitch} / 45
    loop players within 16 blocks of player:
        play sound "minecraft:block.note_block.flute" with volume 1000 with pitch {angle} to loop-player
    message "%{angle}%"
 
Ok. What exactly are you asking. Are you getting errors with your code? If so what are they. When posting you need to post these details so people can help you
 
Hello,
you will need to calculate a number between 0 and 1 using the player's pitch or yaw.
The following code sets a pitch and yaw variable which is the player's yaw/pitch represented by a number between 0 and 1.
SCSS:
set {_pitch} to (loop-player's pitch + 90) / 180
set {_yaw} to loop-player's yaw / 360
You can use the pitch or yaw variable as the sound's pitch.