unreal.RayCastHelper

class unreal.RayCastHelper(outer: Object | None = None, name: Name | str = 'None')

Bases: LearningAgentsHelper

A helper for performing various kinds of ray cast.

C++ Source:

  • Plugin: LearningAgents

  • Module: LearningAgents

  • File: LearningAgentsHelpers.h

Editor Properties: (see get_editor_property/set_editor_property)

  • manager_component (LearningAgentsManagerComponent): [Read-Only] Reference to the Manager Component this helper is associated with.

classmethod add_ray_cast_helper(manager_component, name='None') RayCastHelper

Adds a new ray cast helper to the given manager component.

Parameters:
  • manager_component (LearningAgentsManagerComponent) – The manager component to add this helper to (such as an Interactor or Trainer).

  • name (Name) – The name of this new helper. Used for debugging.

Returns:

The newly created helper.

Return type:

RayCastHelper

ray_cast_grid_heights(agent_id=-1, position, rotation, row_num=5, col_num=5, row_width=1000.000000, col_width=1000.000000, max_height=10000.000000, min_height=-10000.000000, collision_channel=CollisionChannel.ECC_WORLD_STATIC) Array[float]

Samples a grid of heights from above.

Parameters:
  • agent_id (int32) – The agent id to run the helper for.

  • position (Vector) – The central position of the grid.

  • rotation (Rotator) – The orientation of the grid.

  • row_num (int32) – The number of rows in the grid.

  • col_num (int32) – The number of columns in the grid.

  • row_width (float) – The width of grid rows.

  • col_width (float) – The width of grid columns.

  • max_height (float) – The height at which to start ray casts from.

  • min_height (float) – The height at which to send ray casts to.

  • collision_channel (CollisionChannel) – The collision channel to use for the ray-casts.

Returns:

out_heights (Array[float]): The output array of heights for each ray in the grid.

Return type:

Array[float]

ray_cast_radial(agent_id=-1, position, rotation, ray_num=7, min_angle=-90.000000, max_angle=90.000000, max_ray_dist=500.000000, local_forward=[1.000000, 0.000000, 0.000000], collision_channel=CollisionChannel.ECC_WORLD_STATIC) Array[float]

Casts rays out in a radius from a given position.

Parameters:
  • agent_id (int32) – The agent id to run the helper for.

  • position (Vector) – The central position of the ray cast.

  • rotation (Rotator) – The orientation of the ray cast.

  • ray_num (int32) – The number of rays to cast.

  • min_angle (float) – The minimum angle to spread the rays.

  • max_angle (float) – The maximum angle to spread the rays.

  • max_ray_dist (float) – The maximum distance at which to shoot rays.

  • local_forward (Vector) –

  • collision_channel (CollisionChannel) – The collision channel to use for the ray-casts.

Returns:

out_distances (Array[float]): The output array of distances for each ray from the start position.

Return type:

Array[float]