TrackingCameraBehavior
public class TrackingCameraBehavior : CameraBehavior
extension TrackingCameraBehavior: NativeBase
extension TrackingCameraBehavior: Hashable
Use this class to follow a moving target. The camera smoothly tracks the target’s position while adjusting heading, tilt, and zoom as needed. When tracking starts or resumes, the camera first animates a re-centering transition to align with the target.
Note: This is a beta release of this feature and may contain bugs or exhibit unexpected behaviour. Related APIs are subject to change without a deprecation process.
-
Creates a new instance of this class.
Declaration
Swift
public init() -
The normalized principal point. Normalized principal point to be used during navigation. Defaults to (0.5, 0.775), which means the camera will use the position slightly at the bottom of the mapview.
Declaration
Swift
public var normalizedPrincipalPoint: Anchor2D { get set } -
The view rectangle for camera updates. Defines a sub-space of the screen that the behavior should consider for camera updates. Using a view rectangle keeps the camera positioning consistent across different screen types and orientations without per-screen principal point adjustments. Defaults to
nil. If not set, it uses the viewport bounds of the underlying map view.Declaration
Swift
public var viewRectangle: Rectangle2D? { get set } -
Defines how the camera starts following the current position when this camera behavior becomes active. Use
CameraTransitionMode.instantto skip the camera animation, for example when returning from a route overview to guidance. The default value isCameraTransitionMode.animated.Declaration
Swift
public var cameraTransitionMode: CameraTransitionMode { get set } -
The duration of recenter animation in milliseconds. When the camera recenter on the target, the transition is animated over this duration. Defaults to 500 milliseconds, or half a second.
Declaration
Swift
public var recenterAnimationDuration: TimeInterval { get set } -
The duration of the fixed-duration fast animation in milliseconds. When
TrackingCameraBehavior.flagFixedDurationForNextAnimation(...)is called, the next animation is performed over this duration. Defaults to 500 milliseconds, or half a second.Declaration
Swift
public var fixedAnimationDuration: TimeInterval { get set } -
The duration of principal point animation in milliseconds. If the principal point is changed, the change is animated over this duration. Defaults to 500 milliseconds, or half a second.
Declaration
Swift
public var principalPointAnimationDuration: TimeInterval { get set } -
The value of camera tilt in degrees. Camera tilt angle relative to the ground plane, in degrees. Defaults to 50.
Declaration
Swift
public var tiltInDegrees: Double { get } -
The camera bearing in degrees. Optional fixed bearing, from true North (0 degrees) in clockwise direction. The valid range is [0, 360]. If set, it will prevent the map from rotating to the direction of travel. For example, a value of zero results in “north up” mode. Defaults to
nil, which means the camera derives the bearing from theLocation, so that it points to the direction of travel. If this property isniland the device does not provide bearing, the last known value is used or zero otherwise.Declaration
Swift
public var bearingInDegrees: Double? { get set } -
The maximum rotation speed. Maximum bearing rotation speed in degrees per second, limiting how fast the camera turns. Defaults to 60 degrees per second.
Declaration
Swift
public var maxRotationSpeedInDegreesPerSecond: Double { get set } -
The zoom transition speed in units per second. Speed controlling how quickly the camera transitions between zoom values. The unit depends on the configured zoom measure kind: zoom levels per second when using ZOOM_LEVEL, meters per second when using DISTANCE_IN_METERS. Defaults to 0.5 (zoom levels per second, matching the default ZOOM_LEVEL kind).
Declaration
Swift
public var zoomSpeed: Double { get set } -
The heading stabilization threshold in degrees. Minimum angular change required before the heading signal updates. Values below this threshold are filtered out to reduce noise and jitter. Defaults to 5 degrees.
Declaration
Swift
public var headingStabilizationThresholdInDegrees: Double { get set } -
The strategy of computing the zoom value. Defines the strategy used to compute the zoom value based on scene heuristics. Defaults to a fixed zoom policy at zoom value 19.0.
Declaration
Swift
public var zoomPolicy: TrackingCameraBehavior.ZoomPolicy { get set } -
The kind of map measure used for zoom representation in the entire configuration. Determines whether values of zoom in the configuration are interpreted as
MapMeasure.Kind.zoomLevelorMapMeasure.Kind.distanceInMeters. UseTrackingCameraBehavior.setZoomMeasureKind(...)to change.MapMeasure.Kind.scaleis not supported. Defaults toMapMeasure.Kind.zoomLevel.Declaration
Swift
public var zoomMeasureKind: MapMeasure.Kind { get } -
The strategy of computing the tilt angle. Defines the strategy used to compute the tilt angle based on scene heuristics. Defaults to a fixed tilt policy at tilt degrees 45.0.
Declaration
Swift
public var tiltPolicy: TrackingCameraBehavior.TiltPolicy { get set } -
The time constant for exponential convergence when a policy uses dynamic animation speed. Controls how quickly tilt and zoom converge to their target values when the active policy uses dynamic animation speed. Lowering the time constant results in more dynamic response, while increasing it makes the response slower. Defaults to 1000 ms.
Declaration
Swift
public var dynamicAnimationSpeed: TrackingCameraBehavior.DynamicSpeedOptions { get set } -
Whether maneuver detection is enabled. When
true, the camera detects adjacent maneuvers and reacts according to theTrackingCameraBehavior.ManeuverModeConfigurationset viaTrackingCameraBehavior.setManeuverModeConfiguration(...). A validTrackingCameraBehavior.ManeuverModeConfigurationmust be set for the camera to react. Defaults tofalse.Declaration
Swift
public var isManeuverDetectionEnabled: Bool { get set } -
Defines tilt behavior in different policy settings.
See moreDeclaration
Swift
public class TiltPolicyextension TrackingCameraBehavior.TiltPolicy: NativeBaseextension TrackingCameraBehavior.TiltPolicy: Hashable -
Defines zoom behavior in different policy settings.
See moreDeclaration
Swift
public class ZoomPolicyextension TrackingCameraBehavior.ZoomPolicy: NativeBaseextension TrackingCameraBehavior.ZoomPolicy: Hashable -
Defines a zoom value triggered when the vehicle reaches a specific speed.
See moreDeclaration
Swift
public struct SpeedThreshold -
Configuration for mapping functional road classes to zoom values. For correct default initialization, use
See moreTrackingCameraBehavior.defaultFunctionalRoadClassZoomPolicyOptions(...).Declaration
Swift
public struct FunctionalRoadClassZoomPolicyOptions -
Configuration for computing zoom values from speed thresholds defined per road classification. For correct default initialization, use
See moreTrackingCameraBehavior.defaultSpeedBasedZoomPolicyOptions(...).Declaration
Swift
public struct SpeedBasedZoomPolicyOptions -
A matched rule configuration holding a target value and the distance thresholds that determine when the rule becomes active around a maneuver point.
See moreDeclaration
Swift
public struct ManeuverRuleConfiguration -
Defines a set of configurations specific to a
See moreTrackingCameraBehavior.ManeuverRule. WhenTrackingCameraBehavior.ManeuverRuleOptions.zoomis set, the zoom reacts to the maneuver using its own distance thresholds. WhenTrackingCameraBehavior.ManeuverRuleOptions.tiltis set, the tilt reacts to the maneuver using its own distance thresholds. Both may be active simultaneously for smooth combined transitions.Declaration
Swift
public struct ManeuverRuleOptions -
Defines a single rule that determines how
See moreTrackingCameraBehaviorreacts to nearby maneuvers when the current position matches this rule.Declaration
Swift
public struct ManeuverRule -
Configuration that defines how
TrackingCameraBehaviorreacts to nearby maneuvers.On each frame, and based on the current position, the availability of its functional road class, and the availability of maneuver data for at least one adjacent maneuver, the camera checks for a match against the
TrackingCameraBehavior.ManeuverModeConfiguration.maneuverRulesin the order they are listed. If a match is found, subsequent rules are not checked. If no match is found, if inputs are unavailable, or if the matched rule hasniloptions, the camera does not react.For correct default initialization, use
See moreTrackingCameraBehavior.defaultManeuverModeConfiguration(...).Declaration
Swift
public struct ManeuverModeConfiguration -
Definition of single speed-based tilt entry used in
See moreTrackingCameraBehavior.SpeedBasedTiltPolicyOptions.Declaration
Swift
public struct SpeedBasedTiltEntry -
Configuration for the speed-based tilt policy. Tilt is linearly interpolated between
See moreTrackingCameraBehavior.SpeedBasedTiltEntry.minTiltInDegreesandTrackingCameraBehavior.SpeedBasedTiltEntry.maxTiltInDegreesas speed increases from 0 toTrackingCameraBehavior.SpeedBasedTiltEntry.maxSpeedInMetersPerSecond. Above that speed tilt stays atTrackingCameraBehavior.SpeedBasedTiltEntry.maxTiltInDegrees.Declaration
Swift
public struct SpeedBasedTiltPolicyOptions -
Defines the animation speed of camera attributes, how quickly they move toward their target values. Each attribute is eased toward its target using exponential smoothing.
See moreDeclaration
Swift
public struct DynamicSpeedOptions -
Enables fixed-duration animation mode for the next property change. When called, the next setter call (e.g., tilt_in_degrees or bearing_in_degrees) will animate using a fast fixed-duration animation instead of the default speed-based animation. The flag is automatically reset after the next setter is called.
Declaration
Swift
public func flagFixedDurationForNextAnimation() -
Sets the zoom measure kind and the zoom speed simultaneously.
MapMeasure.Kind.scaleis not supported.Declaration
Swift
public func setZoomMeasureKind(zoomMeasureKind: MapMeasure.Kind, zoomSpeed: Double)Parameters
zoomMeasureKindThe measure kind to use.
zoomSpeedThe zoom transition speed appropriate for the new kind.
-
Sets the configuration for camera behavior near maneuvers. Defines how the camera reacts to nearby maneuvers when
TrackingCameraBehavior.isManeuverDetectionEnabledistrue. When set tonil, the camera does not react to maneuvers. The configuration must contain at least one rule to be valid. Defaults tonil.Declaration
Swift
public func setManeuverModeConfiguration(maneuverModeConfiguration: TrackingCameraBehavior.ManeuverModeConfiguration?)Parameters
maneuverModeConfigurationThe maneuver mode configuration. Invalid configurations are rejected.
-
Gets the current maneuver mode configuration, or
nilif not set.Declaration
Swift
public func getManeuverModeConfiguration() -> TrackingCameraBehavior.ManeuverModeConfiguration?Return Value
The current maneuver mode configuration.
-
Declaration
Swift
public static func defaultFunctionalRoadClassZoomPolicyOptions() -> TrackingCameraBehavior.FunctionalRoadClassZoomPolicyOptionsReturn Value
The default
TrackingCameraBehavior.FunctionalRoadClassZoomPolicyOptions. -
Declaration
Swift
public static func defaultSpeedBasedZoomPolicyOptions() -> TrackingCameraBehavior.SpeedBasedZoomPolicyOptionsReturn Value
The default
TrackingCameraBehavior.SpeedBasedZoomPolicyOptions. -
Declaration
Swift
public static func defaultManeuverModeConfiguration() -> TrackingCameraBehavior.ManeuverModeConfigurationReturn Value
The default
TrackingCameraBehavior.ManeuverModeConfiguration.