Package openmw.cameraΒΆ

openmw.camera controls camera.

Can be used only by player scripts.

Usage:

local camera = require('openmw.camera')

Type camera

camera.MODE

Camera modes.

camera.allowCharacterDeferredRotation(boolValue)

If set to true then after switching from Preview to ThirdPerson the player character turns to the camera view direction.

camera.getExtraPitch()

Additional summand for the pitch angle that is not affected by player input.

camera.getExtraYaw()

Additional summand for the yaw angle that is not affected by player input.

camera.getFirstPersonOffset()

The offset between the characters head and the camera in first person mode (3d vector).

camera.getFocalPreferredOffset()

Preferred offset between tracked position (see getTrackedPosition) and the camera focal point (the center of the screen) in third person mode.

camera.getFocalTransitionSpeed()

The current speed coefficient of focal point (the center of the screen in third person mode) smooth transition.

camera.getMode()

Return the current openmw.camera#MODE.

camera.getPitch()

Camera pitch angle (radians) without taking extraPitch into account.

camera.getPosition()

Current position of the camera.

camera.getQueuedMode()

Return the mode the camera will switch to after the end of the current animation.

camera.getRoll()

Get camera roll angle (radians).

camera.getThirdPersonDistance()

The actual distance between the camera and the character in third person mode; can differ from the preferred one if there is an obstacle.

camera.getTrackedPosition()

Current position of the tracked object (the characters head if there is no animation).

camera.getYaw()

Camera yaw angle (radians) without taking extraYaw into account.

camera.instantTransition()

Make instant the current transition of camera focal point and the current deferred rotation (see allowCharacterDeferredRotation).

camera.setExtraPitch(value)

Additional summand for the pitch angle; useful for camera shaking effects.

camera.setExtraYaw(value)

Additional summand for the yaw angle; useful for camera shaking effects.

camera.setFirstPersonOffset(offset)

Set the offset between the characters head and the camera in first person mode (3d vector).

camera.setFocalPreferredOffset(offset)

Set preferred offset between tracked position (see getTrackedPosition) and the camera focal point (the center of the screen) in third person mode.

camera.setFocalTransitionSpeed(speed)

Set the speed coefficient of focal point (the center of the screen in third person mode) smooth transition.

camera.setMode(mode, force)

Change openmw.camera#MODE; if the second (optional, true by default) argument is set to false, the switching can be delayed (see getQueuedMode).

camera.setPitch(value)

Force the pitch angle to the given value (radians); player input on this axis is ignored in this frame.

camera.setPreferredThirdPersonDistance(distance)

Set preferred distance between the camera and the character in third person mode.

camera.setRoll(value)

Set camera roll angle (radians).

camera.setStaticPosition(pos)

Set camera position; can be used only if camera is in Static mode.

camera.setYaw(value)

Force the yaw angle to the given value (radians); player input on this axis is ignored in this frame.

camera.showCrosshair(boolValue)

Show/hide crosshair.

Type MODE

MODE.FirstPerson

First person mode.

MODE.Preview

Third person mode, but player character doesn't turn to the view direction.

MODE.Static

Camera doesn't track player; player inputs doesn't affect camera; use setStaticPosition to move the camera.

MODE.ThirdPerson

Third person mode; player character turns to the view direction.

MODE.Vanity

Similar to Preview; camera slowly moves around the player.

Type camera

Field(s)

#MODE camera.MODE

Camera modes.

camera.allowCharacterDeferredRotation(boolValue)

If set to true then after switching from Preview to ThirdPerson the player character turns to the camera view direction.

Otherwise the camera turns to the character view direction.

Parameter

  • #boolean boolValue :

camera.getExtraPitch()

Additional summand for the pitch angle that is not affected by player input.

Full pitch is getPitch()+getExtraPitch().

Return value

#number:

camera.getExtraYaw()

Additional summand for the yaw angle that is not affected by player input.

Full yaw is getYaw()+getExtraYaw().

Return value

#number:

camera.getFirstPersonOffset()

The offset between the characters head and the camera in first person mode (3d vector).

Return value

openmw.util#Vector3:

camera.getFocalPreferredOffset()

Preferred offset between tracked position (see getTrackedPosition) and the camera focal point (the center of the screen) in third person mode.

See setFocalPreferredOffset.

Return value

openmw.util#Vector2:

camera.getFocalTransitionSpeed()

The current speed coefficient of focal point (the center of the screen in third person mode) smooth transition.

Return value

#number:

camera.getMode()

Return the current openmw.camera#MODE.

Return value

#MODE:

camera.getPitch()

Camera pitch angle (radians) without taking extraPitch into account.

Full pitch is getPitch()+getExtraPitch().

Return value

#number:

camera.getPosition()

Current position of the camera.

Return value

openmw.util#Vector3:

camera.getQueuedMode()

Return the mode the camera will switch to after the end of the current animation.

Can be nil.

Return value

#MODE:

camera.getRoll()

Get camera roll angle (radians).

Return value

#number:

camera.getThirdPersonDistance()

The actual distance between the camera and the character in third person mode; can differ from the preferred one if there is an obstacle.

Return value

#number:

camera.getTrackedPosition()

Current position of the tracked object (the characters head if there is no animation).

Return value

openmw.util#Vector3:

camera.getYaw()

Camera yaw angle (radians) without taking extraYaw into account.

Full yaw is getYaw()+getExtraYaw().

Return value

#number:

camera.instantTransition()

Make instant the current transition of camera focal point and the current deferred rotation (see allowCharacterDeferredRotation).

camera.setExtraPitch(value)

Additional summand for the pitch angle; useful for camera shaking effects.

Setting extra pitch doesn't block player input. Full pitch is getPitch()+getExtraPitch().

Parameter

  • #number value :

camera.setExtraYaw(value)

Additional summand for the yaw angle; useful for camera shaking effects.

Setting extra pitch doesn't block player input. Full yaw is getYaw()+getExtraYaw().

Parameter

  • #number value :

camera.setFirstPersonOffset(offset)

Set the offset between the characters head and the camera in first person mode (3d vector).

Parameter

camera.setFocalPreferredOffset(offset)

Set preferred offset between tracked position (see getTrackedPosition) and the camera focal point (the center of the screen) in third person mode.

The offset is a 2d vector (X, Y) where X is horizontal (to the right from the character) and Y component is vertical (upward). The real offset can differ from the preferred one during smooth transition of if blocked by an obstacle. Smooth transition happens by default every time when the preferred offset was changed. Use instantTransition() to skip the current transition.

Parameter

camera.setFocalTransitionSpeed(speed)

Set the speed coefficient of focal point (the center of the screen in third person mode) smooth transition.

Smooth transition happens by default every time when the preferred offset was changed. Use instantTransition() to skip the current transition.

Parameter

  • #number speed :

camera.setMode(mode, force)

Change openmw.camera#MODE; if the second (optional, true by default) argument is set to false, the switching can be delayed (see getQueuedMode).

Parameters

  • #MODE mode :

  • #boolean force :

camera.setPitch(value)

Force the pitch angle to the given value (radians); player input on this axis is ignored in this frame.

Parameter

  • #number value :

camera.setPreferredThirdPersonDistance(distance)

Set preferred distance between the camera and the character in third person mode.

Parameter

  • #number distance :

camera.setRoll(value)

Set camera roll angle (radians).

Parameter

  • #number value :

camera.setStaticPosition(pos)

Set camera position; can be used only if camera is in Static mode.

Parameter

camera.setYaw(value)

Force the yaw angle to the given value (radians); player input on this axis is ignored in this frame.

Parameter

  • #number value :

camera.showCrosshair(boolValue)

Show/hide crosshair.

Parameter

  • #boolean boolValue :

Type MODE

Field(s)

#number MODE.FirstPerson

First person mode.

#number MODE.Preview

Third person mode, but player character doesn't turn to the view direction.

#number MODE.Static

Camera doesn't track player; player inputs doesn't affect camera; use setStaticPosition to move the camera.

#number MODE.ThirdPerson

Third person mode; player character turns to the view direction.

#number MODE.Vanity

Similar to Preview; camera slowly moves around the player.