RealDocs

UKismetMathLibrary::DynamicWeightedMovingAverage_FVector

function Engine Blueprint Since unknown
#include "Kismet/KismetMathLibrary.h"
Access: public Specifiers: staticUFUNCTIONBlueprintPure

Description

Like WeightedMovingAverage_FVector, but the blend weight scales with the distance between CurrentSample and PreviousSample, letting small positional jitter be smoothed heavily while large movements are tracked more responsively.

Caveats & Gotchas

  • This is stateless — you must store PreviousSample yourself between calls.
  • MaxDistance is measured as a straight-line distance between the two vectors, so its meaningful scale depends entirely on the units of your samples (centimeters for world positions vs. a normalized direction vector, for example).
  • Like the plain weighted average, this blends per-axis and does not renormalize the result, so smoothing a unit direction vector requires renormalizing afterward.

Signature

static FVector DynamicWeightedMovingAverage_FVector(FVector CurrentSample, FVector PreviousSample, float MaxDistance, float MinWeight, float MaxWeight)

Parameters

Name Type Description Default
CurrentSample FVector The newest raw vector value to blend in.
PreviousSample FVector The previously smoothed vector from the series.
MaxDistance float Distance between samples at which the blend reaches MaxWeight.
MinWeight float Weight used when the distance between samples is small.
MaxWeight float Weight used when the distance between samples is large (at or beyond MaxDistance).

Return Type

FVector

Example

Smooth a tracked hand position with adaptive responsiveness C++
SmoothedHandLocation = UKismetMathLibrary::DynamicWeightedMovingAverage_FVector(RawHandLocation, SmoothedHandLocation, /*MaxDistance=*/20.f, /*MinWeight=*/0.1f, /*MaxWeight=*/0.9f);

Tags

Version History

Introduced in: unknown

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.