Skip to content

MASCamera

MOARdV edited this page Nov 9, 2017 · 10 revisions

The MASCamera module represents a camera installed on a part. The camera may be accessed in a MASMonitor prop module's page. The MASCamera is similar to the JSIExternalCameraSelector, but there are important changes to be aware of:

  • Camera parameters (zoom limits, pan and tilt limits) are part of MASCamera. In RPM, they were part of the page definition, allowing different pages to use different values for the same camera. Putting the limits in the part config better duplicates a physical camera, and it allows the part maker to specify limits based on what the part is emulating.
  • Camera names are user-configurable in the VAB/SPH (or in flight) using a text input box. RPM used a named prefix (traditionally, "ExtCam"), and it allowed the user to increment or decrement a number that was added to the prefix.

The MASCamera is configured with the following values. All user-configurable values and their defaults are included.

MODULE
{
	name = MASCamera

	fovRange = 50, 50
	currentFov = 50
	panRange = 0, 0
	currentPan = 0
	tiltRange = 0, 0
	currentTilt = 0

	cameraTransformName = ""
	cameraResolution = 256
	refreshRate = 1

	translation = 0, 0, 0
	rotation = 0, 0, 0

	cameraName = ""
	showFov = false
}
  • fovRange - Defines the minimum and maximum field of view for the camera, in degrees.
  • currentFov - This value will change in flight if the user zooms a camera, but putting it in the part config allows the part maker to specify the initial setting for the part.
  • panRange - Defines the maximum left and right rotation of the camera, in degrees.
  • currentPan - This value will change in flight if the user pans a camera.
  • tiltRange - Defines the maximum up and down rotation of the camera, in degrees.
  • currentTilt - This value will change in flight if the user tilts a camera.
  • cameraTransformName - Required. Specifies the transform in the prop where the camera is attached. The following two fields allow the camera to be moved and rotated from that location.
  • cameraResolution - Optional. Defaults to 256. Determines the size of the render texture that the camera uses. Valid values range from 64 to 2048. Values outside of that range will be clamped to that range. Values that are not a power-of-2 will be rounded down to the next lower power-of-2. Note that larger render textures may not be beneficial for most players, since their hardware may not support the large sizes, and it could slow down game performance.
  • refreshRate - Optional. Defaults to 1. Controls how frequently the camera's render texture is updated (every refreshRate Unity updates). A 1 means the camera's view updates every Update, while a 2 means every other update, a 3 means every 3rd update, etc.
  • translation - Specifies the offset from cameraTransformName where the camera should be created.
  • rotation - Specifies the rotation (in degrees) that the camera should be rotated from cameraTransformName's forward (blue) axis.
  • cameraName - A user-configurable field naming the camera. An initial default name may be provided in the config.
  • showFov - Whether the field-of-view cones should be visible in the VAB/SPH. This option is controlled by the player using the context menu in the VAB/SPH, and it should not be added to the config file.

Clone this wiki locally