Central camera, that controls the features that require a single "main" camera (features that do not make sense with multiple cameras from multiple viewports).
This camera controls:
Note that it means that "headlight" done by TCastleRootTransform.UseHeadlight is assigned to one camera in case of multiple viewports looking at the same world. You cannot have a different "headlight" in each viewport, this would cause subtle problems since it's not how it would work in reality (where every light is visible in all viewports), e.g. mirror textures (like GeneratedCubeMapTexture) would need different contents in different viewpoints.
Note that we no longer advise using TCastleRootTransform.UseHeadlight for headlight. It's easier to just place light as child of whatever camera you want, like adding TCastleDirectionalLight as child of TCastleCamera. See examples/viewport_and_scenes/headlight/ . In this case MainCamera doesn't matter, instead you explicitly make headlight by placing light as child of chosen camera.
Note that features like LOD or Billboard or ProximitySensor need to transform this camera to scene local space. Which is not possible if the same scene instance is used multiple times (e.g. under many different TCastleTransform parents). If you need to use these features of TCastleScene, then simply do not use the same scene reference multiple times (instead clone the scene by TCastleScene.Clone).
By default this is set to TCastleViewport.Camera of the TCastleViewport that created this TCastleAbstractRootTransform instance. And if something changes the TCastleViewport.Camera of that viewport, then this MainCamera is also updated. So in simple cases (when you just have one TCastleViewport and add your scenes to it's already-created TCastleViewport.Items) you don't have to do anything, it just works. In general, you can change this to any camera (currently used by some associated TCastleViewport or not), or Nil (in case no camera should be that "central" camera).
|