Skip to content

Setting up cameras

Eugene Medvedev edited this page Jul 9, 2014 · 13 revisions

Every monitor page can have a cameraTransform option which instructs it to display a camera on the monitor screen underneath the text. Some of the other modules, in particular background handlers, can also display camera output and will follow the same rules when doing so.

When given a camera transform, the plugin will attempt to find a transform by that name anywhere within the vessel, outside the IVA -- it can't be on the internal space model -- and position there a camera structure that closely mimics KSP's flight camera, so you should get the picture equivalent to what you would see from outside. The search is started with the pod itself, but continues throughout the vessel. It is re-done every time you switch to a different page. If the part where that transform was found falls off, the camera should smoothly stop working. There is one reserved transform name, CurrentReferenceDockingPortCamera, which will position that camera directly on the reference transform of the currently active (as in 'control from here') docking port or grapple device, and move it around when the reference docking port is switched.

Note for the grapple device: If the model of the grapple device contains a transform named ArticulatedCap, this transform will be used for the position of the camera, rather than the actual reference transform of the part. This is to correctly handle the stock grapple device, which has the reference transform deep within the model, which prevents the camera from seeing anything. If you are making your own grapple device, and reference transform is covered by anything, you can place such a named transform somewhere where it won't interfere with camera view.

A note for the user: Whenever you enter IVA, regardless of how exactly did you do it, KSP resets the reference part to be the capsule you went IVA into, so literally going out of IVA to click a 'control from here' option on a docking port will not work, as the moment you go back, the reference part will reset. This is stock behaviour and done during camera switching for some bizarre reason. An option to change the reference part while IVA without looking out is available in the targeting menu provided by the JSITargetMenu page handler, though where it is on your particular monitor is a question better addressed to whoever put the system together.

The recommended place for cameras is the outer model of the pod itself, because that, at least, avoids the inconvenient question "so what if I have more than one pod trying to look through the same outer camera object". They won't conflict, but you might not see what you expect. If you set up cameras on transforms with non-unique names that are on parts other than the pod exterior, there's no telling which will be found first. Look into JSIExternalCameraSelector module (see Part modules) if you want to make bolt-on external camera parts, because it's meant to solve precisely that problem.

Cameras will be pointing in the Z+ direction of the transform, with X+ towards the right of the field of view, and will move if the transform itself moves. Rendering will occur at the moment when the screen would otherwise be cleared with the blanking color. If your font has an alpha background, it will overprint the camera image just like one would expect.

The camera's aspect ratio is set in the RasterPropMonitor module, using the cameraAspect = ... option, so you can tune the aspect ratio to your monitor's size. A perfectly proportioned 4:3 screen has a cameraAspect of ~1.3333, while a perfectly square screen has a cameraAspect of 1, a 16:9 screen has a cameraAspect of ~1.7777.

Everything else about the camera is set up within page definition blocks.