Kerbal Space Program  1.12.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Properties | List of all members
FlightCamera Class Reference
Inheritance diagram for FlightCamera:
IKSPCamera

Public Types

enum  Modes {
  Modes.AUTO, Modes.FREE, Modes.ORBITAL, Modes.CHASE,
  Modes.LOCKED
}
 
enum  TargetMode { TargetMode.None, TargetMode.Vessel, TargetMode.Part, TargetMode.Transform }
 

Public Member Functions

virtual void ActivateUpdate ()
 
virtual void CycleCameraHighlighter ()
 Cycle all cameras Highlighting System On. More...
 
virtual void DeactivateUpdate ()
 
virtual void DisableCamera ()
 
virtual void DisableCamera (bool disableAudioListener)
 Disables this camera, with an optiojn to disable it's audio listener as well. Useful when switching between FlightCamera and PlanetariumCamera, so audio is not different when switching views More...
 
virtual void DisableCameraHighlighter ()
 Cycle all cameras Highlighting System Off. More...
 
virtual void EnableCamera ()
 
Quaternion GetCameraFoR (FoRModes mode)
 
virtual Transform GetCameraTransform ()
 
virtual float getPitch ()
 
virtual Transform GetPivot ()
 
Quaternion getReferenceFrame ()
 
virtual float getYaw ()
 
virtual void OnNavigatorHandoff ()
 
virtual bool OnNavigatorRequestControl ()
 Called before the device takes control of camera input. Return true to allow the device to have control, or false to deny it. More...
 
virtual Func< bool > OnNavigatorTakeOver (Callback RequestControl)
 Called when the device is about to take control of camera input. Return a method to be used to check whether the camera should receive control again. Also if necessary to get control back immediately, you can call the provided callback parameter. More...
 
virtual void ResetFoV ()
 
virtual void ResumeFoV ()
 
virtual void SetCamCoordsFromPosition (Vector3 wPos)
 Set the camera's coordinates (camPitch, camHdg) from the given worldspace position

Parameters
pos
More...
 
virtual void SetDefaultFoV ()
 
virtual void SetDistance (float dist)
 sets the target distance for the camera, so it will lerp to the end position. More...
 
virtual void SetDistanceImmediate (float dist)
 sets the distance for the camera, and moves it immediately to the end position. More...
 
virtual void SetFoV (float fov)
 
virtual void setMode (Modes m)
 
virtual void setModeImmediate (Modes m)
 
void SetNextMode ()
 
virtual void SetTarget (Transform tgt, TargetMode targetMode=TargetMode.Transform)
 
virtual void SetTarget (Transform tgt, bool keepWorldPos, TargetMode targetMode=TargetMode.Transform)
 
virtual void SetTargetNone ()
 
virtual void SetTargetPart (Part part)
 
virtual void SetTargetTransform (Transform tgt)
 
virtual void SetTargetVessel (Vessel vessel)
 
virtual void TargetActiveVessel ()
 

Static Public Member Functions

static void ClearTarget ()
 
static Modes GetAutoModeForVessel (Vessel v)
 
static void MinDistanceBackaway ()
 Adjust the camera distance to be larg enough to show the vessel according to the backoff values More...
 
static void SetMode (Modes m)
 
static void SetModeImmediate (Modes m)
 
static void SetTarget (Vessel vessel)
 
static void SetTarget (Part part)
 
static void SetTarget (Transform transform)
 

Public Attributes

Callback AbortExternalControl = () => { }
 
GameObject AudioListenerGameObject
 Separate gameobject containing the flight camera's audio listener. More...
 
Modes autoMode = Modes.FREE
 
float cameraAlt = 0f
 
Camera[] cameras
 
float cameraWobbleSensitivity = 0.1f
 
float camHdg = 0f
 
float camPitch = 0f
 
float FieldOfView = 60f
 
FoRModes FoRMode = FoRModes.SRF_NORTH
 
float fovDefault = 60f
 
float fovMax = 160f
 
float fovMin = 20f
 
Camera mainCamera
 
float maxDistance = 150000f
 
float maxDistOnDestroy = 400f
 
float maxPitch = 1.55f
 
float minDistance = 3f
 
float minDistOnDestroy = 75f
 
float minHeight
 
float minHeightAtMaxDist = 10000f
 
float minHeightAtMinDist = 10f
 
float minPitch = -0.95f
 
Modes mode = Modes.AUTO
 
float orbitSensitivity = 0.05f
 
float orientationSharpness = 0.05f
 
Part partTarget
 normally null, but will be non-null if the camera has been targeted at a part instead of vessel CoM More...
 
float pivotTranslateSharpness = 0.5f
 
FlightReflectionProbe reflectionProbe = null
 FlightReflectionProbe used to generate reflections of the environment for the vessel materials. More...
 
float sharpness = 10f
 
float startDistance = 30f
 
Vector3 targetDirection
 
TargetMode targetMode = TargetMode.None
 
Vector3 upAxis
 
bool updateActive = true
 
float vesselSwitchBackoffFOVFactor = 1.5f
 Factor to multiply FoV by to scale the view by when calcing initial cameera position. More...
 
float vesselSwitchBackoffPadding = 10f
 Additional distance to add to the backoff distance when calcing the initial camera position More...
 
Vessel vesselTarget
 
float zoomScaleFactor = 1.2f
 

Static Public Attributes

static FlightCamera fetch
 

Protected Types

enum  ChaseMode {
  ChaseMode.Parked, ChaseMode.Velocity, ChaseMode.Target_SrfUp, ChaseMode.Target_YUp,
  ChaseMode.Null
}
 

Protected Member Functions

virtual void Awake ()
 
Quaternion GetChaseFoR (Vessel v)
 
virtual Quaternion getRotation (float pitch, float hdg)
 
virtual void LateUpdate ()
 
virtual void OnDestroy ()
 
virtual void OnLevelLoaded (GameScenes level)
 
virtual void OnSceneLoaded (UnityEngine.SceneManagement.Scene scene, UnityEngine.SceneManagement.LoadSceneMode mode)
 
virtual void OnSceneSwitch (GameScenes scene)
 
virtual void OnTargetDestroyed ()
 
virtual void OnVesselChange (Vessel vessel)
 
virtual void Start ()
 
virtual IEnumerator Startup ()
 
virtual bool TrackIRisActive ()
 
virtual void UpdateCameraTransform ()
 
virtual void updateFoR (Quaternion FoR, float lerpT)
 

Protected Attributes

Vector3 camFXPos
 
Quaternion camFXRot
 
Modes chaseBaseMode
 
Quaternion chaseBaseRot
 
Vector3 chaseFwd
 
ChaseMode chaseMode = ChaseMode.Parked
 
ChaseMode chaseModePrev = ChaseMode.Null
 
float endPitch
 
float FoRlerp = 0f
 
Vector3 nextMove
 
float offsetPitch
 
float tIRpitch
 

Properties

static float CamHdg [get, set]
 
static int CamMode [get]
 
static float CamPitch [get, set]
 
float Distance [get]
 
static FoRModes FrameOfReferenceMode [get]
 
Quaternion pivotRotation [get]
 
Transform Target [get]
 
- Properties inherited from IKSPCamera
bool enabled [get]
 

Member Enumeration Documentation

enum FlightCamera.ChaseMode
protected
Enumerator
Parked 
Velocity 
Target_SrfUp 
Target_YUp 
Null 
Enumerator
AUTO 
FREE 
ORBITAL 
CHASE 
LOCKED 
Enumerator
None 
Vessel 
Part 
Transform 

Member Function Documentation

virtual void FlightCamera.ActivateUpdate ( )
inlinevirtual
virtual void FlightCamera.Awake ( )
inlineprotectedvirtual
static void FlightCamera.ClearTarget ( )
inlinestatic
virtual void FlightCamera.CycleCameraHighlighter ( )
inlinevirtual

Cycle all cameras Highlighting System On.

virtual void FlightCamera.DeactivateUpdate ( )
inlinevirtual
virtual void FlightCamera.DisableCamera ( )
inlinevirtual
virtual void FlightCamera.DisableCamera ( bool  disableAudioListener)
inlinevirtual

Disables this camera, with an optiojn to disable it's audio listener as well. Useful when switching between FlightCamera and PlanetariumCamera, so audio is not different when switching views

Parameters
disableAudioListener
virtual void FlightCamera.DisableCameraHighlighter ( )
inlinevirtual

Cycle all cameras Highlighting System Off.

virtual void FlightCamera.EnableCamera ( )
inlinevirtual
static Modes FlightCamera.GetAutoModeForVessel ( Vessel  v)
inlinestatic
Quaternion FlightCamera.GetCameraFoR ( FoRModes  mode)
inline
virtual Transform FlightCamera.GetCameraTransform ( )
inlinevirtual

Implements IKSPCamera.

Quaternion FlightCamera.GetChaseFoR ( Vessel  v)
inlineprotected
virtual float FlightCamera.getPitch ( )
inlinevirtual

Implements IKSPCamera.

virtual Transform FlightCamera.GetPivot ( )
inlinevirtual

Implements IKSPCamera.

Quaternion FlightCamera.getReferenceFrame ( )
inline

Implements IKSPCamera.

virtual Quaternion FlightCamera.getRotation ( float  pitch,
float  hdg 
)
inlineprotectedvirtual
virtual float FlightCamera.getYaw ( )
inlinevirtual

Implements IKSPCamera.

virtual void FlightCamera.LateUpdate ( )
inlineprotectedvirtual

< collect input

< MMB :: Orbit

< TrackIR look-around

< update camera frame of reference based on camera mode

static void FlightCamera.MinDistanceBackaway ( )
inlinestatic

Adjust the camera distance to be larg enough to show the vessel according to the backoff values

If its already far enough then the distance is maintained

virtual void FlightCamera.OnDestroy ( )
inlineprotectedvirtual
virtual void FlightCamera.OnLevelLoaded ( GameScenes  level)
inlineprotectedvirtual
virtual void FlightCamera.OnNavigatorHandoff ( )
inlinevirtual

Implements IKSPCamera.

virtual bool FlightCamera.OnNavigatorRequestControl ( )
inlinevirtual

Called before the device takes control of camera input. Return true to allow the device to have control, or false to deny it.

Returns

Implements IKSPCamera.

virtual Func<bool> FlightCamera.OnNavigatorTakeOver ( Callback  RequestControl)
inlinevirtual

Called when the device is about to take control of camera input. Return a method to be used to check whether the camera should receive control again. Also if necessary to get control back immediately, you can call the provided callback parameter.

Returns

Implements IKSPCamera.

virtual void FlightCamera.OnSceneLoaded ( UnityEngine.SceneManagement.Scene  scene,
UnityEngine.SceneManagement.LoadSceneMode  mode 
)
inlineprotectedvirtual
virtual void FlightCamera.OnSceneSwitch ( GameScenes  scene)
inlineprotectedvirtual
virtual void FlightCamera.OnTargetDestroyed ( )
inlineprotectedvirtual
virtual void FlightCamera.OnVesselChange ( Vessel  vessel)
inlineprotectedvirtual
virtual void FlightCamera.ResetFoV ( )
inlinevirtual
virtual void FlightCamera.ResumeFoV ( )
inlinevirtual
virtual void FlightCamera.SetCamCoordsFromPosition ( Vector3  wPos)
inlinevirtual

Set the camera's coordinates (camPitch, camHdg) from the given worldspace position

Parameters
pos

Implements IKSPCamera.

virtual void FlightCamera.SetDefaultFoV ( )
inlinevirtual
virtual void FlightCamera.SetDistance ( float  dist)
inlinevirtual

sets the target distance for the camera, so it will lerp to the end position.

Parameters
dist
virtual void FlightCamera.SetDistanceImmediate ( float  dist)
inlinevirtual

sets the distance for the camera, and moves it immediately to the end position.

Parameters
dist
virtual void FlightCamera.SetFoV ( float  fov)
inlinevirtual
static void FlightCamera.SetMode ( Modes  m)
inlinestatic
virtual void FlightCamera.setMode ( Modes  m)
inlinevirtual
static void FlightCamera.SetModeImmediate ( Modes  m)
inlinestatic
virtual void FlightCamera.setModeImmediate ( Modes  m)
inlinevirtual
void FlightCamera.SetNextMode ( )
inline
static void FlightCamera.SetTarget ( Vessel  vessel)
inlinestatic
static void FlightCamera.SetTarget ( Part  part)
inlinestatic
static void FlightCamera.SetTarget ( Transform  transform)
inlinestatic
virtual void FlightCamera.SetTarget ( Transform  tgt,
TargetMode  targetMode = TargetMode.Transform 
)
inlinevirtual
virtual void FlightCamera.SetTarget ( Transform  tgt,
bool  keepWorldPos,
TargetMode  targetMode = TargetMode.Transform 
)
inlinevirtual

< find the active target and focus it

< EVAs don't like wobbly cameras, it gets jittery.

virtual void FlightCamera.SetTargetNone ( )
inlinevirtual
virtual void FlightCamera.SetTargetPart ( Part  part)
inlinevirtual
virtual void FlightCamera.SetTargetTransform ( Transform  tgt)
inlinevirtual
virtual void FlightCamera.SetTargetVessel ( Vessel  vessel)
inlinevirtual
virtual void FlightCamera.Start ( )
inlineprotectedvirtual
virtual IEnumerator FlightCamera.Startup ( )
inlineprotectedvirtual
virtual void FlightCamera.TargetActiveVessel ( )
inlinevirtual
virtual bool FlightCamera.TrackIRisActive ( )
inlineprotectedvirtual
virtual void FlightCamera.UpdateCameraTransform ( )
inlineprotectedvirtual

< allow the target's rotation to influence the camera a little.

< clamp local pitch to 89°

virtual void FlightCamera.updateFoR ( Quaternion  FoR,
float  lerpT 
)
inlineprotectedvirtual

Member Data Documentation

Callback FlightCamera.AbortExternalControl = () => { }
GameObject FlightCamera.AudioListenerGameObject

Separate gameobject containing the flight camera's audio listener.

Modes FlightCamera.autoMode = Modes.FREE
float FlightCamera.cameraAlt = 0f
Camera [] FlightCamera.cameras
float FlightCamera.cameraWobbleSensitivity = 0.1f
Vector3 FlightCamera.camFXPos
protected
Quaternion FlightCamera.camFXRot
protected
float FlightCamera.camHdg = 0f
float FlightCamera.camPitch = 0f
Modes FlightCamera.chaseBaseMode
protected
Quaternion FlightCamera.chaseBaseRot
protected
Vector3 FlightCamera.chaseFwd
protected
ChaseMode FlightCamera.chaseMode = ChaseMode.Parked
protected
ChaseMode FlightCamera.chaseModePrev = ChaseMode.Null
protected
float FlightCamera.endPitch
protected
FlightCamera FlightCamera.fetch
static
float FlightCamera.FieldOfView = 60f
float FlightCamera.FoRlerp = 0f
protected
FoRModes FlightCamera.FoRMode = FoRModes.SRF_NORTH
float FlightCamera.fovDefault = 60f
float FlightCamera.fovMax = 160f
float FlightCamera.fovMin = 20f
Camera FlightCamera.mainCamera
float FlightCamera.maxDistance = 150000f
float FlightCamera.maxDistOnDestroy = 400f
float FlightCamera.maxPitch = 1.55f
float FlightCamera.minDistance = 3f
float FlightCamera.minDistOnDestroy = 75f
float FlightCamera.minHeight
float FlightCamera.minHeightAtMaxDist = 10000f
float FlightCamera.minHeightAtMinDist = 10f
float FlightCamera.minPitch = -0.95f
Modes FlightCamera.mode = Modes.AUTO
Vector3 FlightCamera.nextMove
protected
float FlightCamera.offsetPitch
protected
float FlightCamera.orbitSensitivity = 0.05f
float FlightCamera.orientationSharpness = 0.05f
Part FlightCamera.partTarget

normally null, but will be non-null if the camera has been targeted at a part instead of vessel CoM

float FlightCamera.pivotTranslateSharpness = 0.5f
FlightReflectionProbe FlightCamera.reflectionProbe = null

FlightReflectionProbe used to generate reflections of the environment for the vessel materials.

float FlightCamera.sharpness = 10f
float FlightCamera.startDistance = 30f
Vector3 FlightCamera.targetDirection
TargetMode FlightCamera.targetMode = TargetMode.None
float FlightCamera.tIRpitch
protected
Vector3 FlightCamera.upAxis
bool FlightCamera.updateActive = true
float FlightCamera.vesselSwitchBackoffFOVFactor = 1.5f

Factor to multiply FoV by to scale the view by when calcing initial cameera position.

To cater to spacing around vessel on the screen.

float FlightCamera.vesselSwitchBackoffPadding = 10f

Additional distance to add to the backoff distance when calcing the initial camera position

Vessel FlightCamera.vesselTarget
float FlightCamera.zoomScaleFactor = 1.2f

Property Documentation

float FlightCamera.CamHdg
staticgetset
int FlightCamera.CamMode
staticget
float FlightCamera.CamPitch
staticgetset
float FlightCamera.Distance
get
FoRModes FlightCamera.FrameOfReferenceMode
staticget
Quaternion FlightCamera.pivotRotation
get
Transform FlightCamera.Target
get

The documentation for this class was generated from the following file: