Download
(7Kb)
Download
Updated: 09-04-09 08:19 PM
Pictures
File Info
Updated:09-04-09 08:19 PM
Created:unknown
Downloads:4,090
Favorites:10
MD5:

LibCamera-1.0

Version: 1.0 r780
by: Saiket [More]

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

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.

Code:
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.
Code:
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.

  • 1.0 r780 Now handles high pitchLimits properly while not flying. In these cases, the camera can't turn upside down anymore, but rather flips over to right itself.
  • 1.0 r725 Updated calls to SaveView, as slot 1 is no longer reserved for first-person view.
  • 1.0 r549: Uses new GetPlayerFacing API.
  • 1.0 r360:
    • Fixed a bug where pitch values erroneously reported 0 near the pitch limit.
    • Bound the yaw value between 0 and 2pi.
    • Update events now only fire when the camera moves a noticeable amount.
    • Added a "LibCamera_UpdateDistance" event and related query function that only fires on zoom.
  • 1.0 r204: TOC bumped to 30000.
  • 1.0 r125: Now works properly even when the minimap is hidden.
There have been no comments posted to this file.
Be the first to add one.



Category Jump:

Support AddOn Development!

You have just downloaded by the author . If you like this AddOn why not consider supporting the author? This author has set up a donation account. Donations ensure that authors can continue to develop useful tools for everyone.