unreal.SplineComponentHelper
¶
- class unreal.SplineComponentHelper(outer: Object | None = None, name: Name | str = 'None')¶
Bases:
LearningAgentsHelper
A helper for computing various properties from a SplineComponent.
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_spline_component_helper(manager_component, name='None') SplineComponentHelper ¶
Adds a new spline component 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:
- get_direction_at_distance_along_spline(agent_id=-1, spline_component, distance_along_spline, coordinate_space=SplineCoordinateSpace.WORLD) Vector ¶
Gets the direction along a spline at the given distance.
- Parameters:
agent_id (int32) – The agent id to run the helper for.
spline_component (SplineComponent) – The spline component to use.
distance_along_spline (float) – The distance along the spline to use.
coordinate_space (SplineCoordinateSpace) – The coordinate space to use for the spline.
- Returns:
The direction at the given distance along the spline.
- Return type:
- get_distance_along_spline_at_position(agent_id=-1, spline_component, position, coordinate_space=SplineCoordinateSpace.WORLD) float ¶
Gets the distance along a spline closest to the provided position.
- Parameters:
agent_id (int32) – The agent id to run the helper for.
spline_component (SplineComponent) – The spline component to use.
position (Vector) – The position to find the closest position to.
coordinate_space (SplineCoordinateSpace) – The coordinate space to use for the spline.
- Returns:
The distance along the spline of the closest position.
- Return type:
- get_nearest_position_on_spline(agent_id=-1, spline_component, position, coordinate_space=SplineCoordinateSpace.WORLD) Vector ¶
Gets the position on a spline closest to the provided position.
- Parameters:
agent_id (int32) – The agent id to run the helper for.
spline_component (SplineComponent) – The spline component to use.
position (Vector) – The position to find the closest position to.
coordinate_space (SplineCoordinateSpace) – The coordinate space to use for the spline.
- Returns:
The closest position on the spline.
- Return type:
- get_position_at_distance_along_spline(agent_id=-1, spline_component, distance_along_spline, coordinate_space=SplineCoordinateSpace.WORLD) Vector ¶
Gets the position along a spline at the given distance.
- Parameters:
agent_id (int32) – The agent id to run the helper for.
spline_component (SplineComponent) – The spline component to use.
distance_along_spline (float) – The distance along the spline to use.
coordinate_space (SplineCoordinateSpace) – The coordinate space to use for the spline.
- Returns:
The position at the given distance along the spline.
- Return type:
- get_positions_along_spline(agent_id=-1, spline_component, position_num, start_distance_along_spline, stop_distance_along_spline, coordinate_space=SplineCoordinateSpace.WORLD) Array[Vector] ¶
Gets an array of positions sampled along a spline between some starting and stopping distance. Deals properly for splines which are looped.
- Parameters:
agent_id (int32) – The agent id to run the helper for.
spline_component (SplineComponent) – The spline component to use.
position_num (int32) – The number of positions to sample along the spline.
start_distance_along_spline (float) – The starting distance along the spline.
stop_distance_along_spline (float) – The stopping distance along the spline.
coordinate_space (SplineCoordinateSpace) – The coordinate space to use for the spline.
- Returns:
out_positions (Array[Vector]): Output array of spline positions.
- Return type:
- get_proportion_along_spline(agent_id=-1, spline_component, distance_along_spline) float ¶
Gets the proportion along a spline in the range 0-1 for a given distance.
- Parameters:
agent_id (int32) – The agent id to run the helper for.
spline_component (SplineComponent) – The spline component to use.
distance_along_spline (float) – The distance along the spline to use.
- Returns:
The proportion along the spline in the range 0-1.
- Return type:
- get_proportion_along_spline_as_angle(agent_id=-1, spline_component, distance_along_spline) float ¶
Gets the proportion along a spline encoded as an angle between -180 and 180 degrees for a given distance. This should be used for looped splines.
- Parameters:
agent_id (int32) – The agent id to run the helper for.
spline_component (SplineComponent) – The spline component to use.
distance_along_spline (float) – The distance along the spline to use.
- Returns:
The proportion along the spline encoded as an angle between -180 and 180 degrees
- Return type:
- get_velocity_along_spline(agent_id=-1, spline_component, position, velocity, finite_difference_delta=10.000000, coordinate_space=SplineCoordinateSpace.WORLD) float ¶
Gets the velocity a point is traveling along a spline.
- Parameters:
agent_id (int32) – The agent id to run the helper for.
spline_component (SplineComponent) – The spline component to use.
position (Vector) – The position of the point.
velocity (Vector) – The velocity of the point.
finite_difference_delta (float) – The finite difference delta used to estimate the velocity along the spline.
coordinate_space (SplineCoordinateSpace) – The coordinate space to use for the spline.
- Returns:
The scalar velocity the point is traveling along the spline.
- Return type: