From Blue Mars Developer Guidebook
The ARDefaultCamera is a camera that automatically follows the local avatar. The presence of this entity also tells the system to spawn an avatar upon entering a level. This entity must be placed in a level in order to automatically spawn an avatar and use the default camera.
Place an ARDefaultCamera entity in your level from the Entity Browser in the RollupBar.
The default camera targets the main SpawnPoint in your level. With the ARDefaultCamera selected, click the "Pick Target" button and select the SpawnPoint.
Upon entering a level, this SpawnPoint's position and rotation is used to set the avatar's position and rotation. The position and rotation of the ARDefaultCamera is only used for the view while the level is loading; it should be above ground, facing a desirable direction for the initial view.
- Tip: A good way to position the ARDefaultCamera is to align it to the SpawnPoint, then move it up along the z-axis to the head of the yellow SpawnPoint model. To see the exact initial view, place a RollupBar>Objects tab>Camera entity in the level and align it to the ARDefaultCamera; then right-click Perspective (upper left corner of the City Editor Viewport) and choose Camera > Camera1 to look through the camera. The Camera1 entity can then be removed from the level.
Controlling Camera Distance via FlowGraph
The ARDefaultCamera can be controlled in the FlowGraph via the CameraDistance input and PreviousCameraDistance output ports. When a new CameraDistance is set, the user maintains the ability to control the camera as usual.
- An integer, 1 to 12, representing 12 preset distance values. Each setting is pictured below in the Camera Distance Settings section.
- Setting 1 is zoomed all the way out to the highest top-down view
- Setting 7 is the default
- Setting 12 is zoomed all the way in to first person view
- Upon setting a new CameraDistance, the previous setting is stored. Use this value to return to the previous setting.
In this example, an ARAvatarTrigger's Enter event is used to set the CameraDistance to 10, with the Math:SetNumber node. On the trigger's Leave event, the PreviousCameraDistance is used to set the CameraDistance to restore the original setting. Pictured below, this FlowGraph is used to automatically control the camera upon entering a store.
Camera Distance Settings
Each of the available CameraDistance settings is pictured below. The default distance is set to 7 upon entering a city.
Please be aware that this feature is still experimental and these values may change in the future.