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.
| Constructor Attributes | Constructor Name and Description |
|---|---|
| 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.
|
|
|
setClosestDistance(distance)
Set the closest distance the camera can be from the orbit point.
|
|
|
setDistance(distance)
Set the camera 'distance' away from the orbit point.
|
|
|
setFarthestDistance(distance)
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
- Returns:
- {float} The closest distance camera can reside from the orbit point.
- Returns:
- {float} distance from the camera to the orbit point.
- Returns:
- {float} The farthest distance the camera can reside from the orbit point.
- Returns:
- {Array} The point which the camera is orbiting.
- Parameters:
- {float} distance
- Must be greater than 0.
- Parameters:
- {float} distance
- Must be greater than 0.
- Parameters:
- {float} angle
- in radians.
- Parameters:
- {float} distance
- Must be greater than zero and less than or equal to getFarthestDistance().
- Parameters:
- {float} distance
- Parameters:
- {float} distance
- Must be less than or equal to getClosestDistance().
- Parameters:
- {Array} orbitPoint
- The new vector the camera will orbit and look at.
- Parameters:
- {Array} position
- The new position of the camera.
- Parameters:
- {String} delimiter Optional, Default: ","
- A string which will separate values.
- Returns:
- {String} a string representation of this camera.
- Parameters:
- {float} angle
- in radians.