Class ProjectileMovementComponent
ProjectileMovementComponent updates the position of another component during its tick.
Inherited Members
Namespace: UE4.Engine
Assembly: UE4DotNet.dll
Syntax
public class ProjectileMovementComponent : MovementComponent
Remarks
Behavior such as bouncing after impacts and homing toward a target are supported.
Normally the root component of the owning actor is moved, however another component may be selected (see SetUpdatedComponent()). If the updated component is simulating physics, only the initial launch parameters (when initial velocity is non-zero) will affect the projectile, and the physics sim will take over from there.
@see UMovementComponent
Properties
| Improve this Doc View SourcebBounceAngleAffectsFriction
Declaration
public bool bBounceAngleAffectsFriction { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
bForceSubStepping
Declaration
public bool bForceSubStepping { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
bInitialVelocityInLocalSpace
Declaration
public bool bInitialVelocityInLocalSpace { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
bInterpMovement
Declaration
public bool bInterpMovement { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
bInterpRotation
Declaration
public bool bInterpRotation { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
bIsHomingProjectile
Declaration
public bool bIsHomingProjectile { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
bIsSliding
Declaration
public bool bIsSliding { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
BounceAdditionalIterations
On the first few bounces (up to this amount), allow extra iterations over MaxSimulationIterations if necessary.
Declaration
public int BounceAdditionalIterations { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
BounceVelocityStopSimulatingThreshold
If velocity is below this threshold after a bounce, stops simulating and triggers the OnProjectileStop event.
Declaration
public float BounceVelocityStopSimulatingThreshold { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Remarks
Ignored if bShouldBounce is false, in which case the projectile stops simulating on the first impact. @see StopSimulating(), OnProjectileStop
Bounciness
Percentage of velocity maintained after the bounce in the direction of the normal of impact (coefficient of restitution).
Declaration
public float Bounciness { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Remarks
1.0 = no velocity lost, 0.0 = no bounce. Ignored if bShouldBounce is false.
bRotationFollowsVelocity
Declaration
public bool bRotationFollowsVelocity { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
bShouldBounce
Declaration
public bool bShouldBounce { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
bSimulationEnabled
Declaration
public bool bSimulationEnabled { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
bSweepCollision
Declaration
public bool bSweepCollision { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Buoyancy
Buoyancy of UpdatedComponent in fluid. 0.0=sinks as fast as in air, 1.0=neutral buoyancy
Declaration
public float Buoyancy { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
DefaultObject
Get UE4 Default Object for this Class
Declaration
public static ProjectileMovementComponent DefaultObject { get; }
Property Value
| Type | Description |
|---|---|
| ProjectileMovementComponent |
Friction
Coefficient of friction, affecting the resistance to sliding along a surface.
Declaration
public float Friction { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Remarks
Normal range is [0,1] : 0.0 = no friction, 1.0+ = very high friction. Also affects the percentage of velocity maintained after the bounce in the direction tangent to the normal of impact. Ignored if bShouldBounce is false. @see bBounceAngleAffectsFriction
HomingAccelerationMagnitude
The magnitude of our acceleration towards the homing target. Overall velocity magnitude will still be limited by MaxSpeed.
Declaration
public float HomingAccelerationMagnitude { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
InitialSpeed
Initial speed of projectile. If greater than zero, this will override the initial Velocity value and instead treat Velocity as a direction.
Declaration
public float InitialSpeed { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
InterpLocationMaxLagDistance
Max distance behind UpdatedComponent which the interpolated component is allowed to lag.
Declaration
public float InterpLocationMaxLagDistance { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
InterpLocationSnapToTargetDistance
Max distance behind UpdatedComponent beyond which the interpolated component is snapped to the target location instead.
Declaration
public float InterpLocationSnapToTargetDistance { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Remarks
For instance if the target teleports this far beyond the interpolated component, the interpolation is snapped to match the target.
InterpLocationTime
"Time" over which most of the location interpolation occurs, when the UpdatedComponent (target) moves ahead of the interpolated component.
Declaration
public float InterpLocationTime { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Remarks
Since the implementation uses exponential lagged smoothing, this is a rough time value and experimentation should inform a final result. A value of zero is effectively instantaneous interpolation.
InterpRotationTime
"Time" over which most of the rotation interpolation occurs, when the UpdatedComponent (target) moves ahead of the interpolated component.
Declaration
public float InterpRotationTime { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Remarks
Since the implementation uses exponential lagged smoothing, this is a rough time value and experimentation should inform a final result. A value of zero is effectively instantaneous interpolation.
MaxSimulationIterations
Max number of iterations used for each discrete simulation step.
Declaration
public int MaxSimulationIterations { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Remarks
Increasing this value can address precision issues with fast-moving objects or complex collision scenarios, at the cost of performance.
WARNING: if (MaxSimulationTimeStep * MaxSimulationIterations) is too low for the min framerate, the last simulation step may exceed MaxSimulationTimeStep to complete the simulation. @see MaxSimulationTimeStep, bForceSubStepping
MaxSimulationTimeStep
Max time delta for each discrete simulation step.
Declaration
public float MaxSimulationTimeStep { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Remarks
Lowering this value can address precision issues with fast-moving objects or complex collision scenarios, at the cost of performance.
WARNING: if (MaxSimulationTimeStep * MaxSimulationIterations) is too low for the min framerate, the last simulation step may exceed MaxSimulationTimeStep to complete the simulation. @see MaxSimulationIterations, bForceSubStepping
MaxSpeed
Limit on speed of projectile (0 means no limit).
Declaration
public float MaxSpeed { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
MinFrictionFraction
When bounce angle affects friction, apply at least this fraction of normal friction.
Declaration
public float MinFrictionFraction { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Remarks
Helps consistently slow objects sliding or rolling along surfaces or in valleys when the usual friction amount would take a very long time to settle.
PreviousHitNormal
Saved HitResult Normal from previous simulation step that resulted in an impact. If PreviousHitTime is 1.0, then the hit was not in the last step.
Declaration
public Vector PreviousHitNormal { get; }
Property Value
| Type | Description |
|---|---|
| Vector |
PreviousHitTime
Saved HitResult Time (0 to 1) from previous simulation step. Equal to 1.0 when there was no impact.
Declaration
public float PreviousHitTime { get; }
Property Value
| Type | Description |
|---|---|
| System.Single |
ProjectileGravityScale
Custom gravity scale for this projectile. Set to 0 for no gravity.
Declaration
public float ProjectileGravityScale { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
StaticClass
Get UE4 Class
Declaration
public static Class StaticClass { get; }
Property Value
| Type | Description |
|---|---|
| Class |
Methods
| Improve this Doc View SourceIsInterpolationComplete()
Returns whether interpolation is complete because the target has been reached. True when interpolation is disabled.
Declaration
public bool IsInterpolationComplete()
Returns
| Type | Description |
|---|---|
| System.Boolean |
IsVelocityUnderSimulationThreshold()
Returns true if velocity magnitude is less than BounceVelocityStopSimulatingThreshold.
Declaration
public bool IsVelocityUnderSimulationThreshold()
Returns
| Type | Description |
|---|---|
| System.Boolean |
LimitVelocity(Vector)
Don't allow velocity magnitude to exceed MaxSpeed, if MaxSpeed is non-zero.
Declaration
public Vector LimitVelocity(Vector NewVelocity)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | NewVelocity |
Returns
| Type | Description |
|---|---|
| Vector |
MoveInterpolationTarget(Vector, Rotator)
Moves the UpdatedComponent, which is also the interpolation target for the interpolated component.
Declaration
public void MoveInterpolationTarget(Vector NewLocation, Rotator NewRotation)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | NewLocation | |
| Rotator | NewRotation |
Remarks
If there is not interpolated component, this simply moves UpdatedComponent. Use this typically from PostNetReceiveLocationAndRotation() or similar from an Actor.
New(UObject, Name)
Spawn an object of this class
Declaration
public static ProjectileMovementComponent New(UObject obj = null, Name name = default(Name))
Parameters
| Type | Name | Description |
|---|---|---|
| UObject | obj | |
| Name | name |
Returns
| Type | Description |
|---|---|
| ProjectileMovementComponent |
ResetInterpolation()
Resets interpolation so that interpolated component snaps back to the initial location/rotation without any additional offsets.
Declaration
public void ResetInterpolation()
SetInterpolatedComponent(SceneComponent)
Assigns the component that will be used for network interpolation/smoothing.
Declaration
public void SetInterpolatedComponent(SceneComponent Component)
Parameters
| Type | Name | Description |
|---|---|---|
| SceneComponent | Component |
Remarks
It is expected that this is a component attached somewhere below the UpdatedComponent. When network updates use MoveInterpolationTarget() to move the UpdatedComponent, the interpolated component's relative offset will be maintained and smoothed over the course of future component ticks. The current relative location and rotation of the component is saved as the target offset for future interpolation. @see MoveInterpolationTarget(), bInterpMovement, bInterpRotation
SetVelocityInLocalSpace(Vector)
Sets the velocity to the new value, rotated into Actor space.
Declaration
public void SetVelocityInLocalSpace(Vector NewVelocity)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector | NewVelocity |
StopSimulating(HitResult)
Clears the reference to UpdatedComponent, fires stop event (OnProjectileStop), and stops ticking (if bAutoUpdateTickRegistration is true).
Declaration
public void StopSimulating(HitResult HitResult)
Parameters
| Type | Name | Description |
|---|---|---|
| HitResult | HitResult |
Operators
| Improve this Doc View SourceImplicit(IntPtr to ProjectileMovementComponent)
Convert from IntPtr to UObject
Declaration
public static implicit operator ProjectileMovementComponent(IntPtr p)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IntPtr | p |
Returns
| Type | Description |
|---|---|
| ProjectileMovementComponent |