unreal.OculusFunctionLibrary

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

Bases: unreal.BlueprintFunctionLibrary

Oculus Function Library

C++ Source:

  • Plugin: OculusVR
  • Module: OculusHMD
  • File: OculusFunctionLibrary.h
classmethod add_loading_splash_screen(texture, translation_in_meters, rotation, size_in_meters=[1.000000, 1.000000], delta_rotation=[0.000000, 0.000000, 0.000000], clear_before_add=False) → None

Adds loading splash screen with parameters

Parameters:
  • texture (Texture2D) – (in) A texture asset to be used for the splash. Gear VR uses it as a path for loading icon; all other params are currently ignored by Gear VR.
  • translation_in_meters (Vector) – (in) Initial translation of the center of the splash screen (in meters).
  • rotation (Rotator) – (in) Initial rotation of the splash screen, with the origin at the center of the splash screen.
  • size_in_meters (Vector2D) – (in) Size, in meters, of the quad with the splash screen.
  • delta_rotation (Rotator) – (in) Incremental rotation, that is added each 2nd frame to the quad transform. The quad is rotated around the center of the quad.
  • clear_before_add (bool) – (in) If true, clears splashes before adding a new one.
classmethod clear_loading_splash_screens() → None

Removes all the splash screens.

classmethod enable_auto_loading_splash_screen(auto_show_enabled) → None

Enable Auto Loading Splash Screen deprecated: UOculusFunctionLibrary::EnableAutoLoadingSplashScreen has been deprecated and no longer functions as before. Use the generic UStereoLayerFunctionLibrary::EnableAutoLoadingSplashScreen instead

Parameters:auto_show_enabled (bool) –
classmethod enable_orientation_tracking(orientation_tracking) → None

Enables/disables orientation tracking on devices that support it.

Parameters:orientation_tracking (bool) –
classmethod enable_position_tracking(position_tracking) → None

Enables/disables positional tracking on devices that support it.

Parameters:position_tracking (bool) –
classmethod get_available_display_frequencies() -> Array(float)

Returns the current available frequencies

Returns:
Return type:Array(float)
classmethod get_base_rotation_and_base_offset_in_meters() -> (out_rotation=Rotator, out_base_offset_in_meters=Vector)

Returns current base rotation and base offset. The base offset is currently used base position offset, previously set by the ResetPosition or SetBasePositionOffset calls. It represents a vector that translates the HMD’s position into (0,0,0) point, in meters. The axis of the vector are the same as in Unreal: X - forward, Y - right, Z - up.

Returns:out_rotation (Rotator): (out) Rotator object with base rotation

out_base_offset_in_meters (Vector): (out) base position offset, vector, in meters.

Return type:tuple
classmethod get_base_rotation_and_position_offset() -> (out_rot=Rotator, out_pos_offset=Vector)

Returns current base rotation and position offset. deprecated: A hack, proper camera positioning should be used

Returns:out_rot (Rotator): (out) Rotator object with base rotation

out_pos_offset (Vector): (out) the vector with previously set position offset.

Return type:tuple
classmethod get_current_display_frequency() → float

Returns the current display frequency

Returns:
Return type:float
classmethod get_device_name() → str

Returns the current device’s name

Returns:
Return type:str
classmethod get_gpu_frame_time() → float

Returns the GPU frame time on supported mobile platforms (Go for now)

Returns:
Return type:float
classmethod get_gpu_utilization() -> (is_gpu_available=bool, gpu_utilization=float)

Returns the GPU utilization availability and value

Returns:is_gpu_available (bool):

gpu_utilization (float):

Return type:tuple
classmethod get_guardian_dimensions(boundary_type) → Vector

Returns the dimensions in UE world space of the requested Boundary Type

Parameters:boundary_type (BoundaryType) – (in) An enum representing the boundary type requested, either Outer Boundary (exact guardian bounds) or PlayArea (rectangle inside the Outer Boundary)
Returns:
Return type:Vector
classmethod get_guardian_points(boundary_type, use_pawn_space=False) -> Array(Vector)

Returns the list of points in UE world space of the requested Boundary Type

Parameters:
  • boundary_type (BoundaryType) – (in) An enum representing the boundary type requested, either Outer Boundary (exact guardian bounds) or PlayArea (rectangle inside the Outer Boundary)
  • use_pawn_space (bool) – (in) Boolean indicating to return the points in world space or pawn space
Returns:

Return type:

Array(Vector)

classmethod get_loading_splash_params() -> (texture_path=str, distance_in_meters=Vector, size_in_meters=Vector2D, rotation_axis=Vector, rotation_delta_in_deg=float)

Get Loading Splash Params deprecated: UOculusFunctionLibrary::GetLoadingSplashParams has been deprecated and no longer functions as before. Please use the generic UStereoLayerFunctionLibrary instead.

Returns:texture_path (str):

distance_in_meters (Vector):

size_in_meters (Vector2D):

rotation_axis (Vector):

rotation_delta_in_deg (float):

Return type:tuple
classmethod get_node_guardian_intersection(device_type, boundary_type) → GuardianTestResult

Get the intersection result between a tracked device (HMD or controllers) and a guardian boundary

Parameters:
  • device_type (TrackedDeviceType) – (in) Tracked Device type to test against guardian boundaries
  • boundary_type (BoundaryType) – (in) An enum representing the boundary type requested, either Outer Boundary (exact guardian bounds) or PlayArea (rectangle inside the Outer Boundary)
Returns:

Return type:

GuardianTestResult

classmethod get_play_area_transform() → Transform

Returns the transform of the play area rectangle, defining its position, rotation and scale to apply to a unit cube to match it with the play area.

Returns:
Return type:Transform
classmethod get_point_guardian_intersection(point, boundary_type) → GuardianTestResult

Get the intersection result between a UE4 coordinate and a guardian boundary

Parameters:
  • point (Vector) – (in) Point in UE space to test against guardian boundaries
  • boundary_type (BoundaryType) – (in) An enum representing the boundary type requested, either Outer Boundary (exact guardian bounds) or PlayArea (rectangle inside the Outer Boundary)
Returns:

Return type:

GuardianTestResult

classmethod get_pose(use_orienation_for_player_camera=False, use_position_for_player_camera=False, position_scale=[0.000000, 0.000000, 0.000000]) -> (device_rotation=Rotator, device_position=Vector, neck_position=Vector)

Grabs the current orientation and position for the HMD. If positional tracking is not available, DevicePosition will be a zero vector

Parameters:
  • use_orienation_for_player_camera (bool) – (in) Should be set to ‘true’ if the orientation is going to be used to update orientation of the camera manually.
  • use_position_for_player_camera (bool) – (in) Should be set to ‘true’ if the position is going to be used to update position of the camera manually.
  • position_scale (Vector) – (in) The 3D scale that will be applied to position.
Returns:

device_rotation (Rotator): (out) The device’s current rotation

device_position (Vector): (out) The device’s current position, in its own tracking space

neck_position (Vector): (out) The estimated neck position, calculated using NeckToEye vector from User Profile. Same coordinate space as DevicePosition.

Return type:

tuple

classmethod get_raw_sensor_data(device_type=TrackedDeviceType.HMD) -> (angular_acceleration=Vector, linear_acceleration=Vector, angular_velocity=Vector, linear_velocity=Vector, time_in_seconds=float)

Reports raw sensor data. If HMD doesn’t support any of the parameters then it will be set to zero.

Parameters:device_type (TrackedDeviceType) –
Returns:angular_acceleration (Vector): (out) Angular acceleration in radians per second per second.

linear_acceleration (Vector): (out) Acceleration in meters per second per second.

angular_velocity (Vector): (out) Angular velocity in radians per second.

linear_velocity (Vector): (out) Velocity in meters per second.

time_in_seconds (float): (out) Time when the reported IMU reading took place, in seconds.

Return type:tuple
classmethod get_tiled_multires_level() → TiledMultiResLevel

Returns the current multiresolution level

Returns:
Return type:TiledMultiResLevel
classmethod get_user_profile() → HmdUserProfile or None

Returns current user profile.

Returns:(boolean) True, if user profile was acquired.

profile (HmdUserProfile): (out) Structure to hold current user profile.

Return type:HmdUserProfile or None
classmethod has_input_focus() → bool

Returns true, if the app has input focus.

Returns:
Return type:bool
classmethod has_system_overlay_present() → bool

Returns true, if the system overlay is present.

Returns:
Return type:bool
classmethod hide_loading_icon() → None

Hide Loading Icon deprecated: UOculusFunctionLibrary::HideLoadingIcon has been deprecated and no longer functions as before. Please use the generic UStereoLayerFunctionLibrary instead.

classmethod hide_loading_splash_screen(clear=False) → None

Hide Loading Splash Screen deprecated: UOculusFunctionLibrary::HideLoadingSplashScreen has been deprecated and no longer functions as before. Use the generic UStereoLayerFunctionLibrary::HideSplashScreen instead

Parameters:clear (bool) –
classmethod is_auto_loading_splash_screen_enabled() → bool

Is Auto Loading Splash Screen Enabled deprecated: UOculusFunctionLibrary::IsAutoLoadingSplashScreenEnabled has been deprecated and no longer functions as before. Please use the generic UStereoLayerFunctionLibrary instead.

Returns:
Return type:bool
classmethod is_device_tracked(device_type) → bool

Returns if the device is currently tracked by the runtime or not.

Parameters:device_type (TrackedDeviceType) –
Returns:
Return type:bool
classmethod is_guardian_displayed() → bool

Returns true if the Guardian Outer Boundary is being displayed

Returns:
Return type:bool
classmethod is_loading_icon_enabled() → bool

Is Loading Icon Enabled deprecated: UOculusFunctionLibrary::IsLoadingIconEnabled has been deprecated and no longer functions as before. Please use the generic UStereoLayerFunctionLibrary instead.

Returns:
Return type:bool
classmethod set_base_rotation_and_base_offset_in_meters(rotation, base_offset_in_meters, options) → None

Sets ‘base rotation’ - the rotation that will be subtracted from the actual HMD orientation. Sets base position offset (in meters). The base position offset is the distance from the physical (0, 0, 0) position to current HMD position (bringing the (0, 0, 0) point to the current HMD position) Note, this vector is set by ResetPosition call; use this method with care. The axis of the vector are the same as in Unreal: X - forward, Y - right, Z - up.

Parameters:
  • rotation (Rotator) – (in) Rotator object with base rotation
  • base_offset_in_meters (Vector) – (in) the vector to be set as base offset, in meters.
  • options (OrientPositionSelector) – (in) specifies either position, orientation or both should be set.
classmethod set_base_rotation_and_position_offset(base_rot, pos_offset, options) → None

Sets ‘base rotation’ - the rotation that will be subtracted from the actual HMD orientation. The position offset might be added to current HMD position, effectively moving the virtual camera by the specified offset. The addition occurs after the HMD orientation and position are applied. deprecated: A hack, proper camera positioning should be used

Parameters:
  • base_rot (Rotator) – (in) Rotator object with base rotation
  • pos_offset (Vector) – (in) the vector to be added to HMD position.
  • options (OrientPositionSelector) – (in) specifies either position, orientation or both should be set.
classmethod set_color_scale_and_offset(color_scale, color_offset, apply_to_all_layers=False) → None

Enables/disables orientation tracking on devices that support it.

Parameters:
classmethod set_cpu_and_gpu_levels(cpu_level, gpu_level) → None

Returns if the device is currently tracked by the runtime or not.

Parameters:
  • cpu_level (int32) –
  • gpu_level (int32) –
classmethod set_display_frequency(requested_frequency) → None

Sets the requested display frequency

Parameters:requested_frequency (float) –
classmethod set_guardian_visibility(guardian_visible) → None

Forces the runtime to render guardian at all times or not

Parameters:guardian_visible (bool) – (in) True will display guardian, False will hide it
classmethod set_loading_splash_params(texture_path, distance_in_meters, size_in_meters, rotation_axis, rotation_delta_in_deg) → None

Set Loading Splash Params deprecated: UOculusFunctionLibrary::SetLoadingSplashParams has been deprecated and no longer functions as before. Please use the generic UStereoLayerFunctionLibrary instead.

Parameters:
  • texture_path (str) –
  • distance_in_meters (Vector) –
  • size_in_meters (Vector2D) –
  • rotation_axis (Vector) –
  • rotation_delta_in_deg (float) –
classmethod set_position_scale3d(pos_scale3d) → None

Scales the HMD position that gets added to the virtual camera position. deprecated: This feature is no longer supported.

Parameters:pos_scale3d (Vector) – (in) the scale to apply to the HMD position.
classmethod set_reorient_hmd_on_controller_recenter(recenter_mode) → None

Sets the HMD recenter behavior to a mode that specifies HMD recentering behavior when a controller recenter is performed. If the recenterMode specified is 1, the HMD will recenter on controller recenter; if it’s 0, only the controller will recenter. Returns false if not supported.

Parameters:recenter_mode (bool) –
classmethod set_tiled_multires_level(level) → None

Set the requested multiresolution level for the next frame

Parameters:level (TiledMultiResLevel) –
classmethod show_loading_icon(texture) → None

Show Loading Icon deprecated: UOculusFunctionLibrary::ShowLoadingIcon has been deprecated and no longer functions as before. Please use the generic UStereoLayerFunctionLibrary instead.

Parameters:texture (Texture2D) –
classmethod show_loading_splash_screen() → None

Show Loading Splash Screen deprecated: UOculusFunctionLibrary::ShowLoadingSplashScreen has been deprecated and no longer functions as before. Use the generic UStereoLayerFunctionLibrary::ShowSplashScreen instead