Add-Ons‎ > ‎

LibCamera-1.0

About LibCamera-1.0

Download

LibCamera-1.0 is an embedded library to keep track of where the player's camera is, relative to the world.  Its most useful purpose is to position UI elements relative to the in-game world to simulate a 3D overlay.

Details

Implementation

An illustration of pitch and yaw.
An illustration of pitch and yaw, from Flight dynamics - Wikipedia

Camera position information is retrieved through CVars saved using the SaveView() function.  Those angles, relative to the player, are then transformed to world-relative coordinates using the world map's player direction arrow.  Yaw offsets from FlipCameraYaw() are also taken into account.

User API

.GetCameraPosition()

Returns the pitch, yaw, and distance of the camera from the player.

Pitch, Yaw, Distance = LibStub( "LibCamera-1.0" ).GetCameraPosition();
Pitch
The pitch of the camera, in radians.  0 represents parallel to the horizon, and looking downwards from there increases the pitch value.  Note that pitch is only bounded by the pitchLimit console command, and can go above and below -2π.
Yaw
The yaw of the camera, in radians.  0 represents due north, and the value increases as the camera looks counter-clockwise.  Range of [0,2π).
Distance
The distance from the camera to the player, in meters.  Range of [0,∞).

.GetCameraDistance()

Returns only the distance of the camera from the player.

Distance = LibStub( "LibCamera-1.0" ).GetCameraDistance();
Distance
The distance from the camera to the player, in meters.  Range of [0,∞).

Note: Camera data will not be available unless at least one callback is registered to recieve either "LibCamera_Update" or "LibCamera_UpdateDistance" messages below.

CallbackHandler-1.0 Messages

"LibCamera_Update"
Fired only when the player's camera moves relative to the world, and at most once per frame.  The arguments provided are identical to the return values of .GetCameraPosition() above.
"LibCamera_UpdateDistance"
Fired only when the player's camera zoom changes, and at most once per frame.  The arguments provided are identical to the return values of .GetCameraDistance() above.
Click here to lend your support to: WoW Addon - LibCamera-1.0 and make a donation at www.pledgie.com !
Subpages (1): Change Log

Links