Class SglFirstPersonCamera
Interactor which implements typical First-Person camera movements.
Defined in: ui_interaction.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Constructs a SglFirstPersonCamera object.
|
Field Attributes | Field Name and Description |
---|---|
Getter for the whole object clone.
|
|
Getter for the camera pose matrix.
|
Method Attributes | Method Name and Description |
---|---|
clone()
Clones the object.
|
|
lookAt(positionX, positionY, positionZ, targetX, targetY, targetZ, roll)
Sets camera pose.
|
|
rotate(pitchOffset, yawOffset, rollOffset)
Rotate the camera in its pitch-yaw-roll reference frame.
|
|
translate(xOffset, yOffset, zOffset)
Translates the camera position in its frame of reference.
|
|
translateOnPlane(xOffset, yOffset, zOffset)
Translates the camera position in its frame of reference, while preserving the Y coordinate (i.e.
|
Class Detail
SglFirstPersonCamera()
Constructs a SglFirstPersonCamera object.
The default pose is positioned at the origin, looking towards the -Z axis with 0 degrees roll.
The camera moves on the XZ plane, having +Y as upward axis.
Field Detail
{SglFirstPersonCamera}
get:copy
Getter for the whole object clone.
It returns a clone of the object.
{Array}
get:matrix
Getter for the camera pose matrix.
The camera pose is returned as a 16-element array representing a 4x4 column major transofrmation matrix.
Method Detail
{SglFirstPersonCamera}
clone()
Clones the object.
- Returns:
- {SglFirstPersonCamera} A clone of the object.
{SglFirstPersonCamera}
lookAt(positionX, positionY, positionZ, targetX, targetY, targetZ, roll)
Sets camera pose.
- Parameters:
- {number} positionX
- The X coordinate of the camera position.
- {number} positionY
- The Y coordinate of the camera position.
- {number} positionZ
- The Z coordinate of the camera position.
- {number} targetX
- The X coordinate of the point the camera will be looking at.
- {number} targetY
- The Y coordinate of the point the camera will be looking at.
- {number} targetZ
- The Z coordinate of the point the camera will be looking at.
- {number} roll
- The angle (in radians) of rotation around the view direction (upward vector is kepth at Y axis).
- Returns:
- {SglFirstPersonCamera} A self reference.
{SglFirstPersonCamera}
rotate(pitchOffset, yawOffset, rollOffset)
Rotate the camera in its pitch-yaw-roll reference frame.
- Parameters:
- {number} pitchOffset
- The amount of rotation around the X axis (in radians).
- {number} yawOffset
- The amount of rotation around the Y axis (in radians).
- {number} rollOffset
- The amount of rotation around the view direction (in radians).
- Returns:
- {SglFirstPersonCamera} A self reference.
{SglFirstPersonCamera}
translate(xOffset, yOffset, zOffset)
Translates the camera position in its frame of reference.
- Parameters:
- {number} xOffset
- The amount of translation along the X axis.
- {number} yOffset
- The amount of translation along the Y axis.
- {number} zOffset
- The amount of translation along the Z axis.
- Returns:
- {SglFirstPersonCamera} A self reference.
{SglFirstPersonCamera}
translateOnPlane(xOffset, yOffset, zOffset)
Translates the camera position in its frame of reference, while preserving the Y coordinate (i.e. altitude).
- Parameters:
- {number} xOffset
- The amount of translation along the X axis.
- {number} yOffset
- The amount of translation along the Y axis.
- {number} zOffset
- The amount of translation along the Z axis.
- Returns:
- {SglFirstPersonCamera} A self reference.