Class Index | File Index

Classes


Class c3dl.OrbitCamera


Extends c3dl.Camera.
c3dl.OrbitCamera is a camera which is restricted to orbiting a point in space. The camera orbits the point by moving along an imaginary sphere which is centered on the point.

OrbitCamera is generally used to orbit meshes, but isn't limited to doing so since any point in space can be orbitted. However, since orbitting a mesh is so common, distance limits can be assigned to the camera, which prevent it from entering or going to far from the mesh.

If an object is being orbitted and the object moves, the camera must be set to orbit the new object's position. This can be done by calling setOrbitPoint() and passing in the new object's position.

When an OrbitCamera is created, it will be have the position and orbit point at [0,0,0]. It will be looking down the -Z axis and have a closest and farthest distance of 0.

If the OrbitCamera's closest distance is set to a value which is greater than its current distance, the camera will be 'backed up' so it has a distance equal to the closest distance. Similarly, setting the farthest distance to a smaller value may also move the camera closer to the orbit point.
Defined in: orbitcamera.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Method Summary
Method Attributes Method Name and Description
 
Get the closest distance the camera can reside from the orbit point.
 
Get the distance from the camera to the orbit point.
 
Get the farthest ditance the camera can reside from the orbit point.
 
Get the point the camera is orbiting.
 
goCloser(distance)
Move the camera 'distance' towards the orbit point relative to where the camera is positioned.
 
goFarther(distance)
Move the camera 'distance' away from the orbit point relative to where the camera is positioned.
 
pitch(angle)
Pitch the camera about the orbit point.
 
Set the closest distance the camera can be from the orbit point.
 
setDistance(distance)
Set the camera 'distance' away from the orbit point.
 
Set the farthest distance the camera can move away from the orbit point.
 
setOrbitPoint(orbitPoint)
Set the point which the camera will orbit and look at.
 
setPosition(position)
Set the camera to a new position.
 
toString(delimiter)
Get a string representation of this camera.
 
yaw(angle)
Yaw about the orbit point.
Methods borrowed from class c3dl.Camera:
getDir, getFarClippingPlane, getFieldOfView, getLeft, getNearClippingPlane, getPosition, getUp, setFarClippingPlane, setFieldOfView, setNearClippingPlane
Class Detail
c3dl.OrbitCamera()
Method Detail
{float} getClosestDistance()
Get the closest distance the camera can reside from the orbit point.
Returns:
{float} The closest distance camera can reside from the orbit point.

{float} getDistance()
Get the distance from the camera to the orbit point.
Returns:
{float} distance from the camera to the orbit point.

{float} getFarthestDistance()
Get the farthest ditance the camera can reside from the orbit point.
Returns:
{float} The farthest distance the camera can reside from the orbit point.

{Array} getOrbitPoint()
Get the point the camera is orbiting.
Returns:
{Array} The point which the camera is orbiting.

goCloser(distance)
Move the camera 'distance' towards the orbit point relative to where the camera is positioned. The camera will not move if attempted to move closer than the closest allowed distance.
Parameters:
{float} distance
Must be greater than 0.

goFarther(distance)
Move the camera 'distance' away from the orbit point relative to where the camera is positioned. The camera will not move if attempted to move farther than the farthest distance.
Parameters:
{float} distance
Must be greater than 0.

pitch(angle)
Pitch the camera about the orbit point.
Parameters:
{float} angle
in radians.

setClosestDistance(distance)
Set the closest distance the camera can be from the orbit point. If 'distance' is greater than the current distance the camera is from the orbit point, the camera will be 'backed up' to the new closest distance.
Parameters:
{float} distance
Must be greater than zero and less than or equal to getFarthestDistance().

setDistance(distance)
Set the camera 'distance' away from the orbit point. The distance must be a value between the getClosestDistance() and getFarthestDistance().
Parameters:
{float} distance

setFarthestDistance(distance)
Set the farthest distance the camera can move away from the orbit point. If 'distance' is less than the current distance the camera is from the orbit point, the camera will be pulled in to the new closest distance.
Parameters:
{float} distance
Must be less than or equal to getClosestDistance().

setOrbitPoint(orbitPoint)
Set the point which the camera will orbit and look at. The direction will remain unchanged.
Parameters:
{Array} orbitPoint
The new vector the camera will orbit and look at.

setPosition(position)
Set the camera to a new position. The position must be between the closest and farthest distances.
Parameters:
{Array} position
The new position of the camera.

{String} toString(delimiter)
Get a string representation of this camera.
Parameters:
{String} delimiter Optional, Default: ","
A string which will separate values.
Returns:
{String} a string representation of this camera.

yaw(angle)
Yaw about the orbit point. The camera will remain looking at the orbit point and its position will rotate about the point parallel to the global up axis and intersecting with the orbit point.
Parameters:
{float} angle
in radians.

Documentation generated by JsDoc Toolkit 2.1.0 on Fri Feb 19 2010 17:58:41 GMT-0500 (EST)