unreal.ARLibrary

class unreal.ARLibrary(outer=None, name='None')

Bases: unreal.BlueprintFunctionLibrary

ARBlueprint Library

C++ Source:

  • Module: AugmentedReality
  • File: ARBlueprintLibrary.h
classmethod add_manual_environment_capture_probe(location, extent) → bool

Adds an environment capture probe to the ar world

Parameters:
Returns:

Return type:

bool

classmethod add_runtime_candidate_image(session_config, candidate_texture, friendly_name, physical_width) → ARCandidateImage

Create an ARCandidateImage object and add it to the ARCandidateImageList of the given c UARSessionConfig object.

Note that you need to restart the AR session with the c UARSessionConfig you are adding to to make the change take effect.

On ARCore platform, you can leave the PhysicalWidth to 0 if you don’t know the physical size of the image or the physical size is dynamic. And this function takes time to perform non-trivial image processing (20ms - 30ms), and should be run on a background thread.

Parameters:
Returns:

A c UARCandidateImage Object pointer if the underlying ARPlatform added the candidate image at runtime successfully. Return nullptr otherwise.

Return type:

ARCandidateImage

classmethod debug_draw_pin(ar_pin, world_context_object, color=[0.000000, 0.000000, 0.000000, 0.000000], scale=5.000000, persist_for_seconds=0.000000) → None

Given a c UARPin, draw it for debugging purposes.

Parameters:
classmethod debug_draw_tracked_geometry(tracked_geometry, world_context_object, color=[0.000000, 0.000000, 0.000000, 0.000000], outline_thickness=5.000000, persist_for_seconds=0.000000) → None

Given some real-world geometry being tracked by the Augmented Reality system, draw it on the screen for debugging purposes (rudimentary)

Parameters:
classmethod get_all_geometries() -> Array(ARTrackedGeometry)
Returns:a list of all the real-world geometry as currently seen by the Augmented Reality system
Return type:Array(ARTrackedGeometry)
classmethod get_all_pins() -> Array(ARPin)

Get a list of all the c UARPin objects that the Augmented Reality session is currently using to connect virtual objects to real-world, tracked locations.

Returns:
Return type:Array(ARPin)
classmethod get_all_tracked_environment_capture_probes() -> Array(AREnvironmentCaptureProbe)
Returns:a list of all the tracked environment capture probes as currently seen by the Augmented Reality system
Return type:Array(AREnvironmentCaptureProbe)
classmethod get_all_tracked_images() -> Array(ARTrackedImage)
Returns:a list of all the tracked images as currently seen by the Augmented Reality system
Return type:Array(ARTrackedImage)
classmethod get_all_tracked_planes() -> Array(ARPlaneGeometry)
Returns:a list of all the tracked planes as currently seen by the Augmented Reality system
Return type:Array(ARPlaneGeometry)
classmethod get_all_tracked_points() -> Array(ARTrackedPoint)
Returns:a list of all the tracked points as currently seen by the Augmented Reality system
Return type:Array(ARTrackedPoint)
classmethod get_ar_session_status() → ARSessionStatus

It is intended that you check the status of the Augmented Reality session on every frame and take action accordingly. e.g. if the session stopped for an unexpected reason, you might give the user a prompt to re-start the session

Returns:The status of a current Augmented Reality session: e.g. Running or Not running for a specific reason.
Return type:ARSessionStatus
classmethod get_camera_depth() → ARTextureCameraDepth
Returns:the current camera depth data from the Augmented Reality system
Return type:ARTextureCameraDepth
classmethod get_camera_image() → ARTextureCameraImage
Returns:the current camera image from the Augmented Reality system
Return type:ARTextureCameraImage
classmethod get_current_light_estimate() → ARLightEstimate

An AugmentedReality session can be configured to provide light estimates. The specific approach to light estimation can be configured by the c UARSessionConfig specified during c StartARSession(). This function assumes that you will cast the returned c UARLightEstimate to a derived type corresponding to your session config.

Returns:a c UARLighEstimate that can be cast to a derived class.
Return type:ARLightEstimate
classmethod get_point_cloud() -> Array(Vector)
Returns:the raw point cloud view of the AR scene
Return type:Array(Vector)
classmethod get_session_config() → ARSessionConfig
Returns:the configuration that the current session was started with.
Return type:ARSessionConfig
classmethod get_supported_video_formats(session_type) -> Array(ARVideoFormat)
Parameters:session_type (ARSessionType) –
Returns:The list of supported video formats for this device
Return type:Array(ARVideoFormat)
classmethod get_tracking_quality() → ARTrackingQuality
Returns:how well the tracking system is performing at the moment
Return type:ARTrackingQuality
classmethod get_world_mapping_status() → ARWorldMappingState
Returns:the current world mapping status for the AR world
Return type:ARWorldMappingState
classmethod is_session_type_supported(session_type) → bool

Test whether this type of session is supported by the current Augmented Reality platform. e.g. is your device capable of doing positional tracking or orientation only?

Parameters:session_type (ARSessionType) –
Returns:
Return type:bool
classmethod line_trace_tracked_objects(screen_coord, test_feature_points=True, test_ground_plane=True, test_plane_extents=True, test_plane_boundary_polygon=True) -> Array(ARTraceResult)

Perform a line trace against any real-world geometry as tracked by the AR system.

Parameters:
  • screen_coord (Vector2D) – Coordinate of the point on the screen from which to cast a ray into the tracking space.
  • test_feature_points (bool) –
  • test_ground_plane (bool) –
  • test_plane_extents (bool) –
  • test_plane_boundary_polygon (bool) –
Returns:

a list of c FARTraceResult sorted by distance from camera.

Return type:

Array(ARTraceResult)

classmethod line_trace_tracked_objects3d(start, end, test_feature_points=True, test_ground_plane=True, test_plane_extents=True, test_plane_boundary_polygon=True) -> Array(ARTraceResult)

Perform a line trace against any real-world geometry as tracked by the AR system.

Parameters:
  • start (Vector) – Start point of the trace, in world space.
  • end (Vector) – End point of the trace, in world space.
  • test_feature_points (bool) –
  • test_ground_plane (bool) –
  • test_plane_extents (bool) –
  • test_plane_boundary_polygon (bool) –
Returns:

a list of c FARTraceResult sorted by distance from camera.

Return type:

Array(ARTraceResult)

classmethod pause_ar_session() → None

Pause a running Augmented Reality session without clearing existing state.

classmethod pin_component(component_to_pin, pin_to_world_transform, tracked_geometry=None, debug_name="None") → ARPin

Pin an Unreal Component to a location in tracking spce (i.e. the real world).

Parameters:
  • component_to_pin (SceneComponent) – The component that should be pinned.
  • pin_to_world_transform (Transform) – A transform (in Unreal World Space) that corresponds to a physical location where the component should be pinned.
  • tracked_geometry (ARTrackedGeometry) – An optional, real-world geometry that is recognized by the AR system; any correction to the position of this geometry will be applied to the pinned component.
  • debug_name (Name) – An optional name that will be displayed when this pin is being drawn for debugging purposes.
Returns:

an object representing the pin that connects c ComponentToPin component to a real-world location and optionally to the c TrackedGeometry.

Return type:

ARPin

classmethod pin_component_to_trace_result(component_to_pin, trace_result, debug_name="None") → ARPin

A convenient version of c PinComponent() that can be used in conjunction with a result of a c LineTraceTrackedObjects call.

Parameters:
Returns:

Return type:

ARPin

classmethod remove_pin(pin_to_remove) → None

Remove a pin such that it no longer updates the associated component.

Parameters:pin_to_remove (ARPin) –
classmethod set_alignment_transform(alignment_transform) → None

Set a transform that will be applied to the tracking space. This effectively moves any camera possessed by the Augmented Reality system such that it is pointing at a different spot in Unreal’s World Space. This is often done to support AR scenarios that rely on static geometry and/or lighting.

Note: any movable components that are pinned will appear to stay in place, while anything not pinned or is not movable (static or stationary) will appear to move.

see PinComponent see PinComponentToTraceResult

Parameters:alignment_transform (Transform) –
classmethod start_ar_session(session_config) → None

Begin a new Augmented Reality session. Subsequently, use the c GetARSessionStatus() function to figure out the status of the session.

Parameters:session_config (ARSessionConfig) – Describes the tracking method to use, what kind of geometry to detect in the world, etc.
classmethod stop_ar_session() → None

Stop a running Augmented Reality session and clear any state.

classmethod unpin_component(component_to_unpin) → None

Given a pinned c ComponentToUnpin, remove its attachment to the real world.

Parameters:component_to_unpin (SceneComponent) –