Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add setPlayerRotation(), setPlayerPitch(), and setPlayerDirection()
- Loading branch information
Showing
6 changed files
with
193 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
#' Set a player's rotation | ||
#' | ||
#' Set a player's rotation | ||
#' | ||
#' @md | ||
#' | ||
#' @param angle Angle of rotation (0-360) | ||
#' @param id Player or entity ID | ||
#' | ||
#' @examples | ||
#' \dontrun{ | ||
#' mc_connect() | ||
#' getPlayerIds() | ||
#' current <- getPlayerRotation(355) | ||
#' setPlayerRotation(current + 90, 355) | ||
#' } | ||
#' | ||
#' @seealso [getPlayerRotation()], [setPlayerPitch()], [setPlayerDirection()], | ||
#' [setPlayerPos()] | ||
#' | ||
#' @export | ||
#' | ||
|
||
setPlayerRotation <- function(angle, id) | ||
{ | ||
|
||
mc_sendreceive(merge_data("entity.setRotation", angle, id)) | ||
|
||
} | ||
|
||
|
||
#' Set a player's pitch | ||
#' | ||
#' Set a player's pitch | ||
#' | ||
#' @md | ||
#' | ||
#' @param angle Angle of pitch (-90 is straight up and +90 is straight down) | ||
#' @param id Player or entity ID | ||
#' | ||
#' @examples | ||
#' \dontrun{ | ||
#' mc_connect() | ||
#' getPlayerIds() | ||
#' setPlayerPitch(45, 355) | ||
#' } | ||
#' | ||
#' @seealso [getPlayerPitch()], [setPlayerRotation()], [setPlayerDirection()], | ||
#' [setPlayerPos()] | ||
#' | ||
#' @export | ||
#' | ||
|
||
setPlayerPitch <- function(angle, id) | ||
{ | ||
|
||
mc_send(merge_data("player.setPitch", angle, id)) | ||
|
||
} | ||
|
||
|
||
|
||
|
||
#' Set a player's direction | ||
#' | ||
#' Set a player's direction | ||
#' | ||
#' @md | ||
#' | ||
#' @param x east/west direction | ||
#' @param y up/down direction | ||
#' @param z north/south direction | ||
#' @param id Player or entity ID | ||
#' | ||
#' @details (`x`, `y`, `z`) define a unit vector to which the player will now point. | ||
#' | ||
#' @examples | ||
#' \dontrun{ | ||
#' mc_connect() | ||
#' getPlayerIds() | ||
#' setPlayerDirection(45, 355) | ||
#' } | ||
#' | ||
#' @seealso [getPlayerDirection()], [setPlayerRotation()], [setPlayerPitch()], | ||
#' [setPlayerPos()] | ||
#' | ||
#' @export | ||
#' | ||
|
||
setPlayerDirection <- function(x, y, z, id) | ||
{ | ||
|
||
mc_send(merge_data("player.setDirection", x, y, z, id)) | ||
|
||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.