Class MovementComponent
MovementComponent is an abstract component class that defines functionality for moving a PrimitiveComponent (our UpdatedComponent) each tick.
Inheritance
Inherited Members
Namespace: UE4.Engine
Assembly: UE4DotNet.dll
Syntax
public class MovementComponent : ActorComponent
Remarks
Base functionality includes:
- Restricting movement to a plane or axis.
- Utility functions for special handling of collision results (SlideAlongSurface(), ComputeSlideVector(), TwoWallAdjust()).
- Utility functions for moving when there may be initial penetration (SafeMoveUpdatedComponent(), ResolvePenetration()).
- Automatically registering the component tick and finding a component to move on the owning Actor. Normally the root component of the owning actor is moved, however another component may be selected (see SetUpdatedComponent()). During swept (non-teleporting) movement only collision of UpdatedComponent is considered, attached components will teleport to the end location ignoring collision.
Properties
| Improve this Doc View SourcebAutoRegisterPhysicsVolumeUpdates
Declaration
public bool bAutoRegisterPhysicsVolumeUpdates { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
bAutoRegisterUpdatedComponent
Declaration
public bool bAutoRegisterUpdatedComponent { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
bAutoUpdateTickRegistration
Declaration
public bool bAutoUpdateTickRegistration { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
bComponentShouldUpdatePhysicsVolume
Declaration
public bool bComponentShouldUpdatePhysicsVolume { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
bConstrainToPlane
Declaration
public bool bConstrainToPlane { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
bSnapToPlaneAtStart
Declaration
public bool bSnapToPlaneAtStart { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
bTickBeforeOwner
Declaration
public bool bTickBeforeOwner { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
bUpdateOnlyIfRendered
Declaration
public bool bUpdateOnlyIfRendered { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
DefaultObject
Get UE4 Default Object for this Class
Declaration
public static MovementComponent DefaultObject { get; }
Property Value
| Type | Description |
|---|---|
| MovementComponent |
PlaneConstraintNormal
The normal or axis of the plane that constrains movement, if bConstrainToPlane is enabled.
Declaration
public Vector PlaneConstraintNormal { get; }
Property Value
| Type | Description |
|---|---|
| Vector |
Remarks
If for example you wanted to constrain movement to the X-Z plane (so that Y cannot change), the normal would be set to X=0 Y=1 Z=0. This is recalculated whenever PlaneConstraintAxisSetting changes. It is normalized once the component is registered with the game world. @see bConstrainToPlane, SetPlaneConstraintNormal(), SetPlaneConstraintFromVectors()
PlaneConstraintOrigin
The origin of the plane that constrains movement, if plane constraint is enabled.
Declaration
public Vector PlaneConstraintOrigin { get; }
Property Value
| Type | Description |
|---|---|
| Vector |
Remarks
This defines the behavior of snapping a position to the plane, such as by SnapUpdatedComponentToPlane(). @see bConstrainToPlane, SetPlaneConstraintOrigin().
StaticClass
Get UE4 Class
Declaration
public static Class StaticClass { get; }
Property Value
| Type | Description |
|---|---|
| Class |
UpdatedComponent
The component we move and update.
Declaration
public SceneComponent UpdatedComponent { get; }
Property Value
| Type | Description |
|---|---|
| SceneComponent |
Remarks
If this is null at startup and bAutoRegisterUpdatedComponent is true, the owning Actor's root component will automatically be set as our UpdatedComponent at startup. @see bAutoRegisterUpdatedComponent, SetUpdatedComponent(), UpdatedPrimitive
UpdatedPrimitive
UpdatedComponent, cast as a UPrimitiveComponent. May be invalid if UpdatedComponent was null or not a UPrimitiveComponent.
Declaration
public PrimitiveComponent UpdatedPrimitive { get; }
Property Value
| Type | Description |
|---|---|
| PrimitiveComponent |
Velocity
Current velocity of updated component.
Declaration
public Vector Velocity { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector |
Methods
| Improve this Doc View SourceConstrainDirectionToPlane(Vector)
Constrain a direction vector to the plane constraint, if enabled.
Declaration
public Vector ConstrainDirectionToPlane(Vector Direction)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | Direction |
Returns
| Type | Description |
|---|---|
| Vector |
Remarks
@see SetPlaneConstraint
ConstrainLocationToPlane(Vector)
Constrain a position vector to the plane constraint, if enabled.
Declaration
public Vector ConstrainLocationToPlane(Vector Location)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | Location |
Returns
| Type | Description |
|---|---|
| Vector |
ConstrainNormalToPlane(Vector)
Constrain a normal vector (of unit length) to the plane constraint, if enabled.
Declaration
public Vector ConstrainNormalToPlane(Vector Normal)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | Normal |
Returns
| Type | Description |
|---|---|
| Vector |
GetGravityZ()
@return gravity that affects this component
Declaration
public float GetGravityZ()
Returns
| Type | Description |
|---|---|
| System.Single |
GetMaxSpeed()
@return Maximum speed of component in current movement mode.
Declaration
public float GetMaxSpeed()
Returns
| Type | Description |
|---|---|
| System.Single |
GetPhysicsVolume()
@return PhysicsVolume this MovementComponent is using, or the world's default physics volume if none. *
Declaration
public PhysicsVolume GetPhysicsVolume()
Returns
| Type | Description |
|---|---|
| PhysicsVolume |
GetPlaneConstraintAxisSetting()
Get the plane constraint axis setting.
Declaration
public EPlaneConstraintAxisSetting GetPlaneConstraintAxisSetting()
Returns
| Type | Description |
|---|---|
| EPlaneConstraintAxisSetting |
GetPlaneConstraintNormal(Vector)
@return The normal of the plane that constrains movement, enforced if the plane constraint is enabled.
Declaration
public void GetPlaneConstraintNormal(Vector ReturnValue)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | ReturnValue |
GetPlaneConstraintOrigin(Vector)
Get the plane constraint origin.
Declaration
public void GetPlaneConstraintOrigin(Vector ReturnValue)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | ReturnValue |
Remarks
This defines the behavior of snapping a position to the plane, such as by SnapUpdatedComponentToPlane(). @return The origin of the plane that constrains movement, if the plane constraint is enabled.
IsExceedingMaxSpeed(Single)
Returns true if the current velocity is exceeding the given max speed (usually the result of GetMaxSpeed()), within a small error tolerance.
Declaration
public bool IsExceedingMaxSpeed(float MaxSpeed)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | MaxSpeed |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Remarks
Note that under normal circumstances updates cause by acceleration will not cause this to be true, however external forces or changes in the max speed limit can cause the max speed to be violated.
K2_GetMaxSpeedModifier()
@return a scalar applied to the maximum velocity that the component can currently move.
Declaration
public float K2_GetMaxSpeedModifier()
Returns
| Type | Description |
|---|---|
| System.Single |
K2_GetModifiedMaxSpeed()
@return the result of GetMaxSpeed() * GetMaxSpeedModifier().
Declaration
public float K2_GetModifiedMaxSpeed()
Returns
| Type | Description |
|---|---|
| System.Single |
K2_MoveUpdatedComponent(Vector, Rotator, Boolean, Boolean)
Moves our UpdatedComponent by the given Delta, and sets rotation to NewRotation.
Declaration
public (HitResult, bool) K2_MoveUpdatedComponent(Vector Delta, Rotator NewRotation, bool bSweep, bool bTeleport)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | Delta | |
| Rotator | NewRotation | |
| System.Boolean | bSweep | |
| System.Boolean | bTeleport |
Returns
| Type | Description |
|---|---|
| System.ValueTuple<HitResult, System.Boolean> |
Remarks
Respects the plane constraint, if enabled. @return True if some movement occurred, false if no movement occurred. Result of any impact will be stored in OutHit.
New(UObject, Name)
Spawn an object of this class
Declaration
public static MovementComponent New(UObject obj = null, Name name = default(Name))
Parameters
| Type | Name | Description |
|---|---|---|
| UObject | obj | |
| Name | name |
Returns
| Type | Description |
|---|---|
| MovementComponent |
SetPlaneConstraintAxisSetting(EPlaneConstraintAxisSetting)
Set the plane constraint axis setting.
Declaration
public void SetPlaneConstraintAxisSetting(EPlaneConstraintAxisSetting NewAxisSetting)
Parameters
| Type | Name | Description |
|---|---|---|
| EPlaneConstraintAxisSetting | NewAxisSetting |
Remarks
Changing this setting will modify the current value of PlaneConstraintNormal.
@param NewAxisSetting New plane constraint axis setting.
SetPlaneConstraintEnabled(Boolean)
Sets whether or not the plane constraint is enabled.
Declaration
public void SetPlaneConstraintEnabled(bool bEnabled)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | bEnabled |
SetPlaneConstraintFromVectors(Vector, Vector)
Uses the Forward and Up vectors to compute the plane that constrains movement, enforced if the plane constraint is enabled.
Declaration
public void SetPlaneConstraintFromVectors(Vector Forward, Vector Up)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | Forward | |
| Vector | Up |
SetPlaneConstraintNormal(Vector)
Sets the normal of the plane that constrains movement, enforced if the plane constraint is enabled.
Declaration
public void SetPlaneConstraintNormal(Vector PlaneNormal)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | PlaneNormal |
Remarks
Changing the normal automatically sets PlaneConstraintAxisSetting to "Custom".
@param PlaneNormal The normal of the plane. If non-zero in length, it will be normalized.
SetPlaneConstraintOrigin(Vector)
Sets the origin of the plane that constrains movement, enforced if the plane constraint is enabled.
Declaration
public void SetPlaneConstraintOrigin(Vector PlaneOrigin)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | PlaneOrigin |
SetUpdatedComponent(SceneComponent)
Assign the component we move and update.
Declaration
public void SetUpdatedComponent(SceneComponent NewUpdatedComponent)
Parameters
| Type | Name | Description |
|---|---|---|
| SceneComponent | NewUpdatedComponent |
SnapUpdatedComponentToPlane()
Snap the updated component to the plane constraint, if enabled.
Declaration
public void SnapUpdatedComponentToPlane()
StopMovementImmediately()
Stops movement immediately (zeroes velocity, usually zeros acceleration for components with acceleration).
Declaration
public void StopMovementImmediately()
Operators
| Improve this Doc View SourceImplicit(IntPtr to MovementComponent)
Convert from IntPtr to UObject
Declaration
public static implicit operator MovementComponent(IntPtr p)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IntPtr | p |
Returns
| Type | Description |
|---|---|
| MovementComponent |