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 feature; there maybe bugs and unexpected behavior. Related API’s 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 duration of recenter animation in milliseconds. Time to recenter the camera reaching current car position. Defaults to 500 milliseconds, or half a second.

    Declaration

    Swift

    public var recenterAnimationDuration: TimeInterval { get set }
  • The crop rectangle for camera updates. Defines a sub-space of the screen that the behavior should consider for camera updates. If not set, it uses the viewport bounds of the underlying map view.

    Declaration

    Swift

    public var cropRectangle: Rectangle2D? { get set }
  • The duration of principal point animation in milliseconds. If the principal point is changed, the change will be 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 set }
  • 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 the Location, so that it points to the direction of travel. If this property is nil and 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 20 degrees per second.

    Declaration

    Swift

    public var maxRotationSpeedInDegreesPerSecond: Double { get set }
  • The zoom level transition speed. Speed factor controlling how quickly the camera transitions between zoom levels Defaults to 0.5 zoom levels per second.

    Declaration

    Swift

    public var zoomSpeedInLevelsPerSecond: Double { get set }
  • The strategy of computing the zoom level. Defines the strategy used to compute the zoom level based on scene heuristics.

    Declaration

    Swift

    public var zoomPolicy: TrackingCameraBehavior.ZoomPolicy { get set }
  • Whether maneuver detection is enabled. When true, the camera detects adjacent maneuvers and reacts according to the TrackingCameraBehavior.maneuverModeConfiguration. A valid TrackingCameraBehavior.ManeuverModeConfiguration must be set for the camera to react. Defaults to false.

    Declaration

    Swift

    public var isManeuverDetectionEnabled: Bool { get set }
  • The configuration for camera behavior near maneuvers. Defines how the camera reacts to nearby maneuvers when TrackingCameraBehavior.isManeuverDetectionEnabled is true. When set to nil, the camera does not react to maneuvers. The configuration must contain at least one rule to be valid.

    Declaration

    Swift

    public var maneuverModeConfiguration: TrackingCameraBehavior.ManeuverModeConfiguration? { get set }
  • Defines zoom behavior in different policy settings.

    Note: This is a beta feature; there maybe bugs and unexpected behavior. Related API’s are subject to change without a deprecation process.

    See more

    Declaration

    Swift

    public class ZoomPolicy
    extension TrackingCameraBehavior.ZoomPolicy: NativeBase
    extension TrackingCameraBehavior.ZoomPolicy: Hashable
  • Defines a zoom level triggered when the vehicle reaches a specific speed.

    See more

    Declaration

    Swift

    public struct SpeedThreshold
  • Configuration for mapping functional road classes to zoom levels.

    See more

    Declaration

    Swift

    public struct FunctionalRoadClassZoomPolicyOptions
  • Configuration for computing zoom levels from speed thresholds defined per road classification.

    See more

    Declaration

    Swift

    public struct SpeedBasedZoomPolicyOptions
  • Defines the bounds within which the zoom level is constrained when approaching a maneuver. Used as part of TrackingCameraBehavior.ManeuverRuleOptions.

    See more

    Declaration

    Swift

    public struct ManeuverZoomRange
  • Defines a set of configurations specific to a TrackingCameraBehavior.ManeuverRule.

    See more

    Declaration

    Swift

    public struct ManeuverRuleOptions
  • Defines a single rule that determines how TrackingCameraBehavior reacts to nearby maneuvers when the current position matches this rule.

    See more

    Declaration

    Swift

    public struct ManeuverRule
  • Configuration that defines how TrackingCameraBehavior reacts 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.maneuverRules in 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 has nil options, the camera does not react.

    See more

    Declaration

    Swift

    public struct ManeuverModeConfiguration
  • 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()