unreal.MovementUtils

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

Bases: BlueprintFunctionLibrary

MovementUtils: a collection of stateless static BP-accessible functions for a variety of movement-related operations

C++ Source:

  • Plugin: Mover

  • Module: Mover

  • File: MovementUtils.h

classmethod apply_angular_velocity(starting_orient, angular_velocity, delta_seconds) Rotator

Applies a desired angular velocity to a starting rotator over time. Returns the new orientation rotator.

Parameters:
Return type:

Rotator

classmethod apply_angular_velocity_to_quat(starting_orient, angular_velocity_degrees, delta_seconds) Quat

Applies a desired angular velocity to a starting quaternion over time. Returns the new orientation quaternion.

Parameters:
  • starting_orient (Quat)

  • angular_velocity_degrees (Vector)

  • delta_seconds (float)

Return type:

Quat

classmethod apply_angular_velocity_to_rotator(starting_orient, angular_velocity_degrees, delta_seconds) Rotator

Applies a desired angular velocity to a starting rotator over time. Returns the new orientation rotator.

Parameters:
Return type:

Rotator

classmethod apply_gravity_to_orientation_intent(intended_orientation, world_to_gravity, stay_vertical=True) Rotator

Converts intended orientation into orientation rotated by out current gravity

Parameters:
  • intended_orientation (Rotator)

  • world_to_gravity (Quat)

  • stay_vertical (bool)

Return type:

Rotator

classmethod can_escape_gravity(prior_velocity, new_velocity, gravity_accel, delta_seconds) bool

Checks whether a given velocity is strong enough to lift off against gravity

Parameters:
Return type:

bool

classmethod compute_angular_velocity(from_, to, world_to_gravity, delta_seconds, turning_rate_limit=-1.000000) Rotator

Compute Angular Velocity

Parameters:
Return type:

Rotator

classmethod compute_angular_velocity_degrees(from_, to, delta_seconds, turning_rate_limit=-1.000000) Vector

Computes the angular velocity needed to change from one orientation to another within a time frame. Use the optional TurningRateLimit to clamp to a maximum step in degrees per second (negative=unlimited).

Parameters:
Return type:

Vector

classmethod compute_combined_velocity(params) Vector

Returns new velocity based on previous state, movement intent, movement mode’s influence and movement settings

Parameters:

params (ComputeCombinedVelocityParams)

Return type:

Vector

classmethod compute_direction_intent(move_input, move_input_type, max_speed) Vector

Computes the directional movement intent based on input vector and associated type

Parameters:
Return type:

Vector

classmethod compute_slide_delta(moving_comps, delta, pct_of_delta_to_move, normal, hit) Vector

Returns an alternative move delta to slide along a surface, based on parameters describing a blocked attempted move

Parameters:
Return type:

Vector

classmethod compute_velocity(params) Vector

Returns new ground-based velocity (worldspace) based on previous state, movement intent (worldspace), and movement settings

Parameters:

params (ComputeVelocityParams)

Return type:

Vector

classmethod compute_velocity_from_gravity(gravity_accel, delta_seconds) Vector

Returns velocity (units per second) contributed by gravitational acceleration over a given time

Parameters:
Return type:

Vector

classmethod compute_velocity_from_positions(from_pos, to_pos, delta_seconds) Vector

Computes velocity based on start and end positions over time

Parameters:
Return type:

Vector

classmethod constrain_to_plane(vector, movement_plane, maintain_magnitude=True) Vector

Ensures input Vector (typically a velocity, acceleration, or move delta) is limited to a movement plane.

Parameters:
  • vector (Vector)

  • movement_plane (Plane)

  • maintain_magnitude (bool) – if true, vector will be scaled after projection in an attempt to keep magnitude the same

Return type:

Vector

classmethod deduce_up_direction_from_gravity(gravity_acceleration) Vector

Returns the up direction deduced from gravity acceleration, but defaults to mover constants up direction if zero

Parameters:

gravity_acceleration (Vector)

Return type:

Vector

classmethod find_teleport_spot(mover_comp, test_location, test_rotation) Vector or None

Try to find an acceptable non-colliding location to place TestActor as close to possible to TestLocation. Expects TestLocation to be a valid location inside the level. Returns true if a location without blocking collision is found, in which case TestLocation is overwritten with the new clear location. Returns false if no suitable location could be found, in which case TestLocation is unmodified.

Parameters:
Returns:

test_location (Vector):

Return type:

Vector or None

classmethod get_gravity_vertical_component(vector, up_direction) Vector

Returns the component of the vector in the gravity-space vertical direction.

Parameters:
Return type:

Vector

classmethod is_angular_velocity_zero(angular_velocity) bool

Is Angular Velocity Zero

Parameters:

angular_velocity (Rotator)

Return type:

bool

classmethod is_exceeding_max_speed(velocity, max_speed) bool

Checks whether a given velocity is exceeding a maximum speed, with some leeway to account for numeric imprecision

Parameters:
Return type:

bool

classmethod project_to_gravity_floor(vector, up_direction) Vector

Project a vector onto the floor defined by the gravity direction.

Parameters:
Return type:

Vector

classmethod test_encroachment(mover_comp, test_location, test_rotation) bool

Returns whether MoverComp’s Actor would encroach at TestLocation on something that blocks it.

Parameters:
Return type:

bool

classmethod test_encroachment_and_adjust(mover_comp, test_location, test_rotation) Vector or None

Returns whether MoverComp’s Actor would encroach at TestLocation on something that blocks it. If blocked, we’ll attempt to find an adjustment and set OutProposedAdjustment accordingly. OutProposedAdjustment will be zero’d if there’s no blockage or an adjustment could not be found.

Parameters:
Returns:

out_proposed_adjustment (Vector):

Return type:

Vector or None

classmethod try_move_to_slide_along_surface(moving_comps, delta, pct_of_delta_to_move, rotation, normal, hit, handle_impact, move_record) -> (float, hit=HitResult, move_record=MovementRecord)

Attempts to move a component along a surface. Returns the percent of time applied, with 0.0 meaning no movement occurred. Note: This function takes a movement record that collects moves applied to the actor see FMovementRecord:

Parameters:
Returns:

hit (HitResult):

move_record (MovementRecord):

Return type:

tuple

classmethod try_move_to_slide_along_surface_no_movement_record(moving_comps, delta, pct_of_delta_to_move, rotation, normal, hit, handle_impact) -> (float, hit=HitResult)

Attempts to move a component along a surface. Returns the percent of time applied, with 0.0 meaning no movement occurred. Note: This function doesn’t update a movement record so velocity should be gathered/set using a different method

Parameters:
Returns:

hit (HitResult):

Return type:

HitResult

classmethod try_safe_move_and_slide_updated_component(moving_comps, delta, new_rotation, sweep, out_hit, teleport, move_record, slide_along_surface=True) -> (float, out_hit=HitResult, move_record=MovementRecord)

Attempts to move a component and resolve any penetration issues with the proposed move Delta. This function handles blocking moves and slides along the surface or stops on impact. It uses TryMoveToSlideAlongSurface: to slide along the surface on hit, so if other behavior is needed for sliding (like Falling based sliding) consider using TrySafeMoveUpdatedComponent: and a slide function or setting bSlideAlongSurface: to false and then using a separate sliding function. Note: This function takes a movement record that collects moves applied to the actor see FMovementRecord.:

Parameters:
  • moving_comps (MovingComponentSet) – Encapsulates components involved in movement

  • delta (Vector) – The desired location change in world space

  • new_rotation (Quat) – The new desired rotation in world space

  • sweep (bool) – Whether we sweep to the destination location

  • out_hit (HitResult) – Optional output describing the blocking hit that stopped the move, if any

  • teleport (TeleportType) – Whether we teleport the physics state (if physics collision is enabled for this object)

  • move_record (MovementRecord) – Move record to add moves to

  • slide_along_surface (bool) – If true the actor slides along a blocking surface. If false the actor will stop if the move was blocked

Returns:

Returns the percent of the move applied 0 to 1, where 1 represents the whole move being applied

out_hit (HitResult): Optional output describing the blocking hit that stopped the move, if any

move_record (MovementRecord): Move record to add moves to

Return type:

tuple

classmethod try_safe_move_and_slide_updated_component_no_movement_record(moving_comps, delta, new_rotation, sweep, out_hit, teleport, slide_along_surface=True) -> (float, out_hit=HitResult)

Attempts to move a component and resolve any penetration issues with the proposed move Delta. This function handles blocking moves and slides along the surface or stops on impact. It uses TryMoveToSlideAlongSurface: to slide along the surface on hit, so if other behavior is needed for sliding (like Falling based sliding) consider using TrySafeMoveUpdatedComponent: and a slide function or setting bSlideAlongSurface: to false and then using a separate sliding function. Note: This function doesn’t update a movement record so velocity should be gathered/set using a different method

Parameters:
  • moving_comps (MovingComponentSet) – Encapsulates components involved in movement

  • delta (Vector) – The desired location change in world space

  • new_rotation (Quat) – The new desired rotation in world space

  • sweep (bool) – Whether we sweep to the destination location

  • out_hit (HitResult) – Optional output describing the blocking hit that stopped the move, if any

  • teleport (TeleportType) – Whether we teleport the physics state (if physics collision is enabled for this object)

  • slide_along_surface (bool) – If true the actor slides along a blocking surface. If false the actor will stop if the move was blocked

Returns:

Returns the percent of the move applied 0 to 1, where 1 represents the whole move being applied

out_hit (HitResult): Optional output describing the blocking hit that stopped the move, if any

Return type:

HitResult

classmethod try_safe_move_updated_component(moving_comps, delta, new_rotation, sweep, out_hit, teleport, move_record) (out_hit=HitResult, move_record=MovementRecord) or None

Attempts to move a component and resolve any penetration issues with the proposed move Delta Note: This function takes a movement record that collects moves applied to the actor see FMovementRecord:

Parameters:
Returns:

out_hit (HitResult):

move_record (MovementRecord):

Return type:

tuple or None

classmethod try_safe_move_updated_component_no_movement_record(moving_comps, delta, new_rotation, sweep, out_hit, teleport) HitResult or None

Attempts to move a component and resolve any penetration issues with the proposed move Delta Note: This function doesn’t update a movement record so velocity should be gathered/set using a different method

Parameters:
Returns:

out_hit (HitResult):

Return type:

HitResult or None