Navigation
API > API/Runtime > API/Runtime/Engine > API/Runtime/Engine/SpringMath
Description
Gives predicted positions, velocities and accelerations for SpringCharacterUpdate. Useful for generating a predicted trajectory given known initial start conditions.
| Name | VelocitySpringCharacterPredict |
| Type | function |
| Header File | /Engine/Source/Runtime/Engine/Public/Animation/SpringMath.h |
| Include Path | #include "Animation/SpringMath.h" |
template<typename TVector>
static void VelocitySpringCharacterPredict
(
TArrayView < TVector > OutPredictedPositions,
TArrayView < TVector > OutPredictedVelocities,
TArrayView < TVector > OutPredictedIntermediateVelocities,
TArrayView < TVector > OutPredictedAccelerations,
const TVector & CurrentPosition,
const TVector & CurrentVelocity,
const TVector & CurrentIntermediateVelocity,
const TVector & CurrentAcceleration,
const TVector & TargetVelocity,
float SmoothingTime,
float MaxAcceleration,
float SecondsPerPredictionStep,
float VDeadzone,
float ADeadzone
)
Parameters
| Name | Remarks |
|---|---|
| TVector | The type of vector to use (e.g. FVector2D, FVector4, FVector etc) |
| OutPredictedPositions | ArrayView of output buffer to put the predicted positions. ArrayView should be the same size as PredictCount |
| OutPredictedVelocities | ArrayView of output buffer to put the predicted velocities. ArrayView should be the same size as PredictCount |
| OutPredictedIntermediateVelocities | ArrayView of output buffer to put the predicted intermediate velocities. ArrayView should be the same size as PredictCount |
| OutPredictedAccelerations | ArrayView of output buffer to put the predicted accelerations. ArrayView should be the same size as PredictCount |
| PredictCount | How many points to predict. Must be greater than 0 |
| CurrentPosition | The initial position of the character |
| CurrentVelocity | The initial velocity of the character |
| CurrentIntermediateVelocity | The initial intermediate velocity of the character |
| CurrentAcceleration | The initial acceleration of the character |
| TargetVelocity | The target velocity of the character |
| SmoothingTime | The smoothing time of the character. It takes roughly the smoothing time in order for the character to reach the target velocity. |
| MaxAcceleration | Puts a limit on the maximum acceleration that the intermediate velocity can do each frame. If MaxAccel is very large, the behaviour wil lbe the same as SpringCharacterUpdate |
| SecondsPerPredictionStep | How much time in between each prediction step. |
| VDeadzone | Deadzone for velocity. Current velocity will snap to target velocity when within the deadzone |
| ADeadzone | Deadzone for acceleration. Acceleration will snap to zero when within the deadzone |