Teleport#
- class omni.kit.tool.teleport.Teleport(test=False)#
Bases:
object
A class for interactive teleportation in the omni.kit.tool.teleport extension.
This class enables users to relocate the camera in the viewport using a visual teleport widget. It processes mouse movements and clicks to determine a new destination, calculates the appropriate camera orientation and focus distance, and updates the camera position accordingly. The teleport functionality is integrated with scene settings and viewport configurations, providing a seamless method for navigating complex scenes.
- Parameters:
test (bool) – Optional flag to enable test mode for setting custom widget files. Defaults to False.
Methods
__init__
([test])destroy
()Destroy the teleport instance and release associated resources.
end_drag
(hit_result)Ends the active drag session and teleports the user based on the hit position if available.
Return the active state of the teleport tool.
get_instance
([test])Return the singleton teleport display instance.
Return the teleport model instance used for managing teleport actions.
Checks if the ring manipulator is enabled based on the current settings.
on_clicked
(coords, hit_result)Processes a click event to initiate teleportation if the click position is significantly different from the previous one and teleportation is allowed.
on_drag
(hit_result)Update widget direction and teleport model orientation during dragging.
on_moved
(coords, hit_result)Update the teleport widget and model based on movement.
set_active
(active[, test])Set the active state for the teleport tool.
set_enabled_picking
(enabled)Enable or disable object picking in the viewport.
set_widget_usd_file
(path)Set the USD file path for the teleport widget.
show_arc
([show])Sets the beam visibility setting to control the display of the teleport arc and makes the teleport model visible.
Unbinds the material from the teleport widget if available.
- __init__(test=False)#
- destroy()#
Destroy the teleport instance and release associated resources.
- end_drag(hit_result: RayQueryResult)#
Ends the active drag session and teleports the user based on the hit position if available.
- Parameters:
hit_result (RayQueryResult) – Raycast result containing hit position and normal values.
- get_active()#
Return the active state of the teleport tool.
- Returns:
Active state flag.
- Return type:
bool
- static get_instance(test=False)#
Return the singleton teleport display instance.
- Parameters:
test (bool) – If true, create instance with test settings.
- Returns:
The single instance of Teleport.
- Return type:
- get_model()#
Return the teleport model instance used for managing teleport actions.
- Returns:
The teleport model instance.
- Return type:
TeleportModel
- is_using_ring_manipulator()#
Checks if the ring manipulator is enabled based on the current settings.
- Returns:
True if the ring manipulator is active, otherwise false.
- Return type:
bool
- on_clicked(
- coords: Sequence[float],
- hit_result: RayQueryResult,
Processes a click event to initiate teleportation if the click position is significantly different from the previous one and teleportation is allowed.
- Parameters:
coords (Sequence[float]) – Click coordinates in normalized device coordinates.
hit_result (RayQueryResult) – Raycast result from the click event.
- on_drag(hit_result: RayQueryResult)#
Update widget direction and teleport model orientation during dragging.
- Parameters:
hit_result (RayQueryResult) – The ray query result containing hit position data.
- on_moved(
- coords: Sequence[float],
- hit_result: RayQueryResult,
Update the teleport widget and model based on movement. Compute widget position and orientation from the ray query results.
- Parameters:
coords (Sequence[float]) – NDC coordinates from the viewport.
hit_result (RayQueryResult) – Result of the ray query indicating surface hit.
- set_active(active, test=False)#
Set the active state for the teleport tool. The widget is hidden if the Welcome window is open.
- Parameters:
active (bool) – True to activate the teleport tool.
test (bool) – Flag for test initialization.
- set_enabled_picking(enabled: bool)#
Enable or disable object picking in the viewport.
- Parameters:
enabled (bool) – Flag to enable or disable picking.
- set_widget_usd_file(path)#
Set the USD file path for the teleport widget.
- Parameters:
path (str) – File path for the USD file to apply to the widget.
- show_arc(show: bool = True)#
Sets the beam visibility setting to control the display of the teleport arc and makes the teleport model visible.
- Parameters:
show (bool) – Flag to show or hide the teleport beam arc.
- unbind_widget_material()#
Unbinds the material from the teleport widget if available.