unreal.CollisionMonitorHelper

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

Bases: LearningAgentsHelper

A helper for monitoring collisions between components.

This object works by monitoring for collisions between a given component and any other components with a given tag. To indicate which component to monitor for collisions SetComponent should be called (generally on the ULearningAgentsManagerComponent::AgentsAdded event) with the corresponding agent id.

If any collisions occur GetCollisionOccurred will report true until it is reset to false either by calling ResetCollisionOccurred or GetAndResetCollisionOccurred. It will also be automatically reset when the agent is reset.

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_collision_monitor_helper(manager_component, name='None') CollisionMonitorHelper

Adds a new collision monitor 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:

CollisionMonitorHelper

get_and_reset_collision_occurred(agent_id=-1) bool

Gets if a collision has occurred for this agent and resets the state of if a collision has occurred back to false.

Parameters:

agent_id (int32) – The agent id to check for collisions for.

Return type:

bool

get_collision_occurred(agent_id=-1) bool

Gets if a collision has occurred for this agent.

Parameters:

agent_id (int32) – The agent id to check for collisions for.

Return type:

bool

reset_collision_occurred(agent_id=-1) None

Resets the state of if a collision has occurred back to false.

Parameters:

agent_id (int32) – The agent id to reset the state for.

set_component(agent_id=-1, component, other_component_tag="None") None

Sets the component to monitor for collisions. Generally this should be called on the ULearningAgentsManagerComponent::AgentsAdded event.

Parameters:
  • agent_id (int32) – The agent id to associate this component with.

  • component (PrimitiveComponent) – The component to monitor for collisions.

  • other_component_tag (Name) – The tag other components must have to trigger collisions.