Skip to content

SetActivePlayerPitch

The SetActivePlayerPitch function sets the pitch of the player to face a specified direction using coordinates (X, Y, Z). This function is particularly useful for controlling the player's orientation while flying.

Parameters

  • x: The X coordinate of the position to set the pitch towards.
  • y: The Y coordinate of the position to set the pitch towards.
  • z: The Z coordinate of the position to set the pitch towards.

Example Usage in Lua

Here is an example of how to use the SetActivePlayerPitch function in Lua:

local api = ...

-- Function to set the player's pitch to face a specified position
function SetPlayerPitch(x, y, z)
    api.SetActivePlayerPitch(x, y, z)
    print("Player's pitch set to face position (" .. x .. ", " .. y .. ", " .. z .. ").")
end

-- Example usage: Set the player's pitch to face position (100, 200, 300)
SetPlayerPitch(100, 200, 300)