unreal.ARLibrary
¶
- class unreal.ARLibrary(outer: Object | None = None, name: Name | str = 'None')¶
Bases:
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
- 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:
session_config (ARSessionConfig) –
candidate_texture (Texture2D) –
friendly_name (str) –
physical_width (float) –
- Returns:
A c UARCandidateImage Object pointer if the underlying ARPlatform added the candidate image at runtime successfully. Return nullptr otherwise.
- Return type:
- classmethod add_tracked_point_with_name(world_transform, point_name, delete_points_with_same_name=True) bool ¶
Manually add a tracked point with name and world transform. WorldTransform:: transform in the world space where the point should be created. PointName:: the name of the created point, must be non-empty. bDeletePointsWithSameName:: if existing points with the same name should be deleted.
- classmethod calculate_alignment_transform(transform_in_first_coordinate_system, transform_in_second_coordinate_system) Transform ¶
Computes a transform that aligns two coordinate systems. Requires the transform of the same known point in each coordinate system.
- classmethod debug_draw_pin(ar_pin, world_context_object, color=[1.000000, 1.000000, 0.000000, 0.750000], scale=5.000000, persist_for_seconds=0.000000) None ¶
Given a c UARPin, draw it for debugging purposes.
- Parameters:
ar_pin (ARPin) –
world_context_object (Object) –
color (LinearColor) –
scale (float) –
persist_for_seconds (float) –
- classmethod debug_draw_tracked_geometry(tracked_geometry, world_context_object, color=[1.000000, 1.000000, 0.000000, 0.750000], 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:
tracked_geometry (ARTrackedGeometry) –
world_context_object (Object) –
color (LinearColor) –
outline_thickness (float) –
persist_for_seconds (float) –
- classmethod find_tracked_points_by_name(point_name) Array[ARTrackedPoint] ¶
- Parameters:
point_name (str) –
- Returns:
a list of the tracked points with the given name
- Return type:
- classmethod get_alignment_transform() Transform ¶
- Returns:
the alignment transform, see “SetAlignmentTransform”
- Return type:
- 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:
- classmethod get_all_geometries_by_class(geometry_class) Array[ARTrackedGeometry] ¶
- Parameters:
- Returns:
a list of all the real-world geometry of the specified class as currently seen by the Augmented Reality system
- Return type:
- 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.
- classmethod get_all_tracked_environment_capture_probes() Array[AREnvironmentCaptureProbe] ¶
Get All Tracked Environment Capture Probes deprecated: GetAllTrackedEnvironmentCaptureProbes is deprecated, use GetAllGeometriesByClass.
- Return type:
- classmethod get_all_tracked_images() Array[ARTrackedImage] ¶
Get All Tracked Images deprecated: GetAllTrackedImages is deprecated, use GetAllGeometriesByClass.
- Return type:
- classmethod get_all_tracked_planes() Array[ARPlaneGeometry] ¶
Get All Tracked Planes deprecated: GetAllTrackedPlanes is deprecated, use GetAllGeometriesByClass.
- Return type:
- classmethod get_all_tracked_points() Array[ARTrackedPoint] ¶
Get All Tracked Points deprecated: GetAllTrackedPoints is deprecated, use GetAllGeometriesByClass.
- Return type:
- classmethod get_all_tracked_poses() Array[ARTrackedPose] ¶
Get All Tracked Poses deprecated: GetAllTrackedPoses is deprecated, use GetAllGeometriesByClass.
- Return type:
- 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:
- classmethod get_ar_texture(texture_type) ARTexture ¶
- Parameters:
texture_type (ARTextureType) –
- Returns:
the AR texture for the specified type
- Return type:
- classmethod get_ar_world_scale() float ¶
- Returns:
the AR world scale, see “SetARWorldScale”
- Return type:
- classmethod get_camera_depth() ARTextureCameraDepth ¶
Get Camera Depth deprecated: GetCameraDepth is deprecated, use GetARTexture.
- Return type:
- classmethod get_camera_image() ARTextureCameraImage ¶
Get Camera Image deprecated: GetCameraImage is deprecated, use GetARTexture.
- Return type:
- classmethod get_camera_intrinsics() ARCameraIntrinsics or None ¶
- Returns:
the intrinsics of the AR camera.
out_camera_intrinsics (ARCameraIntrinsics):
- Return type:
ARCameraIntrinsics or None
- 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:
- classmethod get_number_of_tracked_faces_supported() int32 ¶
- Returns:
the max number of faces can be tracked at the same time
- Return type:
int32
- classmethod get_object_classification_at_location(world_location, max_location_diff=10.000000) (out_classification=ARObjectClassification, out_classification_location=Vector) or None ¶
Try to determine the classification of the object at a world space location InWorldLocation:: the world location where the classification is needed OutClassification:: the classification result OutClassificationLocation:: the world location at where the classification is calculated MaxLocationDiff:: the max distance between the specified world location and the classification location return:: whether a valid classification result is calculated
- classmethod get_person_segmentation_depth_image() ARTexture ¶
Get Person Segmentation Depth Image deprecated: GetPersonSegmentationDepthImage is deprecated, use GetARTexture.
- Return type:
- classmethod get_person_segmentation_image() ARTexture ¶
Get Person Segmentation Image deprecated: GetPersonSegmentationImage is deprecated, use GetARTexture.
- Return type:
- classmethod get_session_config() ARSessionConfig ¶
- Returns:
the configuration that the current session was started with.
- Return type:
- 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:
- classmethod get_tracking_quality() ARTrackingQuality ¶
- Returns:
how well the tracking system is performing at the moment
- Return type:
- classmethod get_tracking_quality_reason() ARTrackingQualityReason ¶
- Returns:
The reason for the current limited tracking state
- Return type:
- classmethod get_world_mapping_status() ARWorldMappingState ¶
- Returns:
the current world mapping status for the AR world
- Return type:
- classmethod is_ar_pin_local_store_ready() bool ¶
Is ARPin Local Store Ready
- Returns:
True if local store is ready for use.
- Return type:
- classmethod is_ar_pin_local_store_supported() bool ¶
Is ARPin Local Store Supported
- Returns:
True if Local Pin saving is supported by the device/platform.
- Return type:
- classmethod is_scene_reconstruction_supported(session_type, scene_reconstruction_method) bool ¶
- Parameters:
session_type (ARSessionType) –
scene_reconstruction_method (ARSceneReconstruction) –
- Returns:
if a particular scene reconstruction method is supported with the specified session type on the current platform
- Return type:
- classmethod is_session_tracking_feature_supported(session_type, session_tracking_feature) bool ¶
- Parameters:
session_type (ARSessionType) –
session_tracking_feature (ARSessionTrackingFeature) –
- Returns:
if a particular session feature is supported with the specified session type on the current platform
- Return type:
- 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) –
- Return type:
- classmethod is_wmr_anchor_store_ready() bool ¶
deprecated: ‘is_wmr_anchor_store_ready’ was renamed to ‘is_ar_pin_local_store_ready’.
- 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:
- Returns:
a list of c FARTraceResult sorted by distance from camera.
- Return type:
- 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:
- Returns:
a list of c FARTraceResult sorted by distance from camera.
- Return type:
- classmethod load_ar_pins_from_local_store() Map[Name, ARPin] ¶
Load all ARPins from local save Note: Multiple loads of a saved pin may result in duplicate pins OR overwritten pins. It is reccomended to only load once.
- 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:
- classmethod pin_component_to_ar_pin(component_to_pin, pin) bool ¶
Associate a component with an ARPin, so that its transform will be updated by the pin. Any previously associated component will be detached.
- Parameters:
component_to_pin (SceneComponent) – The Component which will be updated by the Pin.
pin (ARPin) – The Pin which the component will be updated by.
- Returns:
True if the operation was successful.
- Return type:
- 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:
component_to_pin (SceneComponent) –
trace_result (ARTraceResult) –
debug_name (Name) –
- Return type:
- classmethod remove_all_ar_pins_from_wmr_anchor_store() None ¶
deprecated: ‘remove_all_ar_pins_from_wmr_anchor_store’ was renamed to ‘remove_all_ar_pins_from_local_store’.
- classmethod remove_ar_pin_from_local_store(save_name) None ¶
Remove an ARPin from the local store
- Parameters:
save_name (Name) –
- 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 set_ar_world_origin_location_and_rotation(origin_location, origin_rotation, is_transform_in_world_space=True, maintain_up_direction=True) None ¶
For a point P in the AR local space, whose location and rotation are “OriginLocation” and “OriginRotation” in the world space modify the alignment transform so that the same point P will be transformed to the origin in the world space. bIsTransformInWorldSpace:: whether “OriginLocation” and “OriginRotation” are specified in UE4’s world space or AR system’s local space. bMaintainUpDirection:: if set, only the yaw roation of the alignment transform will be modified, pitch and roll will be zeroed out.
- classmethod set_ar_world_scale(world_scale) None ¶
Helper function that modifies the alignment transform scale so that virtual content in the world space appears to be “scaled”. Note that ultimately the scaling effect is achieved through modifying the translation of the camera: moving the camera further away from the origin makes objects appear to be smaller, and vice versa.
- Parameters:
world_scale (float) –
- classmethod set_enabled_xr_camera(on_off) None ¶
Enable or disable Mixed Reality Capture camera.
- Parameters:
on_off (bool) –
- 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 toggle_ar_capture(on_off, capture_type) bool ¶
Starts or stops a battery intensive service on device.
- Parameters:
on_off (bool) –
capture_type (ARCaptureType) –
- Return type:
- classmethod unpin_component(component_to_unpin) None ¶
Given a pinned c ComponentToUnpin, remove its attachment to the real world.
- Parameters:
component_to_unpin (SceneComponent) –