Learn R Programming

miner (version 0.2.2)

getPlayerDirection: Get player direction as unit vector

Description

Returns a unit vector describing the current direction a player is facing. The default is to get the direction for the first player spawned in the Minecraft, world, but the directions of other players can be gotten using the player_id argument.

Usage

getPlayerDirection(player_id = NULL)

Arguments

player_id

Integer giving the ID of a player. You can find IDs of all current players using getPlayerIds().

Value

A numeric vector of length 3 with coordinates of the player's current direction (gaze) as a unit vector, (x,y,z).

Details

x is east/west with east being the positive direction. y is up/down with up being the positive direction, and z is north/south with south being the positive direction.

See Also

getPlayerRotation(), getPlayerPitch(), getPlayerPos()

Examples

Run this code
# NOT RUN {
getPlayerDirection()

example_playerId <- getPlayerIds()[1]
getPlayerDirection(example_playerId)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab