RealDocs

UAnimInstance::Montage_GetPosition

function Engine Blueprint Since 4.0
#include "Animation/AnimInstance.h"
Access: public Specifiers: ENGINE_APIconstBlueprintPureUFUNCTION

Description

Returns the current playback position of the montage in seconds from the start of the asset. Use this to drive game logic that depends on precise animation timing.

Caveats & Gotchas

  • Returns 0 if the montage is not currently active. Unlike Montage_GetBlendTime, this reflects the position within the animation asset itself, not the blend envelope.
  • Position is measured in asset time, not section-relative time. If you need to know where you are within the current section, subtract the section's start time from the returned value.

Signature

ENGINE_API float Montage_GetPosition(const UAnimMontage* Montage) const;

Parameters

Name Type Description Default
Montage const UAnimMontage* The montage to query. Must not be NULL.

Return Type

float

Example

Spawn projectile at exact animation frame C++
void UMyAnimInstance::NativeUpdateAnimation(float DeltaSeconds)
{
	float Pos = Montage_GetPosition(FireMontage);
	if (!bProjectileSpawned && Pos >= 0.35f)
	{
		SpawnProjectile();
		bProjectileSpawned = true;
	}
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.