trackingMode
TypeScriptget trackingMode(): AnchoringComponent_TrackingModeSwift declarationvar trackingMode: AnchoringComponent.TrackingMode { get set }Defines how the `Entity` tracks its target anchor.
struct · iOS 13.0+ · SDK 27.1
struct AnchoringComponentA component that anchors virtual content to a real world target. This component is essential for getting AR features into RealityKit. Use `AnchoringComponent` to anchor virtual content to a real world target by attaching the component to any ``Entity`` in your RealityKit scene. To create an `AnchoringComponent`, you need to specify a ``AnchoringComponent/Target-swift.enum``. You can also specify the ``AnchoringComponent/TrackingMode-swift.struct`` and the ``AnchoringComponent/PhysicsSimulation-swift.enum`` to control how the entity tracks the anchor and how the physics simulates with the entity. For example, here's how to create an entity that targets the left hand's wrist with predicted tracking mode: ```swift let target = AnchoringComponent.Target.hand(.left, location: .wrist) let anchoringComponent = AnchoringComponent(target, trackingMode: .predicted) let entity = Entity() entity.components.set(anchoringComponent) ``` The entity with `AnchoringComponent` is inactive when created. RealityKit anchors and activates the entity when it finds an anchor that meets the target requirements. You can check the entity's anchored status using ``Entity/isAnchored``, or you can subscribe to ``SceneEvents/AnchoredStateChanged`` events to receive scene events. Similarly, RealityKit unanchors the entity if the target disappears or no longer meets the target requirements. For more information about anchors, see <doc://com.apple.documentation/documentation/arkit>.
get trackingMode(): AnchoringComponent_TrackingModeSwift declarationvar trackingMode: AnchoringComponent.TrackingMode { get set }Defines how the `Entity` tracks its target anchor.
set trackingMode(value: AnchoringComponent_TrackingMode)Swift declarationvar trackingMode: AnchoringComponent.TrackingMode { get set }Defines how the `Entity` tracks its target anchor.
get physicsSimulation(): AnchoringComponent_PhysicsSimulationSwift declarationvar physicsSimulation: AnchoringComponent.PhysicsSimulation { get set }Specifies the physics simulation spece that the entity and its descendants are in.
set physicsSimulation(value: AnchoringComponent_PhysicsSimulation)Swift declarationvar physicsSimulation: AnchoringComponent.PhysicsSimulation { get set }Specifies the physics simulation spece that the entity and its descendants are in.
get target(): AnchoringComponent_TargetSwift declarationlet target: AnchoringComponent.TargetThe real world anchor target to attach the entity to.
static initTrackingModePhysicsSimulation(target: AnchoringComponent_Target, trackingMode: AnchoringComponent_TrackingMode, physicsSimulation?: AnchoringComponent_PhysicsSimulation): AnchoringComponentSwift declarationinit(_ target: AnchoringComponent.Target, trackingMode: AnchoringComponent.TrackingMode, physicsSimulation: AnchoringComponent.PhysicsSimulation = .isolated)Creates an anchoring component for a given target, tracking mode and physics simulation. - Parameters: - target: The kind of real world object to target. - trackingMode: The tracking mode of the entity. - physicsSimulation: The physics simulation space the entity will be in.
static initTrackingMode(target: AnchoringComponent_Target, trackingMode: AnchoringComponent_TrackingMode): AnchoringComponentSwift declarationinit(_ target: AnchoringComponent.Target, trackingMode: AnchoringComponent.TrackingMode)static init(target: AnchoringComponent_Target): AnchoringComponentSwift declarationinit(_ target: AnchoringComponent.Target)Creates an anchoring component for a given target. - Parameters: - target: The kind of real world object to target.
No declarations were skipped in this snapshot.