void rAnimationPlayer::Tick(float time){ if (m_currentAnimation && m_playing){ m_animationTime += time; if (m_animationTime > m_currentAnimation->Duration()){ m_animationTime = m_currentAnimation->Duration(); } UpdateTransformData(); } }
///OnTick: If there is a grabbed component, move it around using the LineTraceEnd vector. void UGrabber::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) { Super::TickComponent(DeltaTime, TickType, ThisTickFunction); if (PhysicsHandle->GrabbedComponent) { UpdateTransformData(); PhysicsHandle->SetTargetLocation(GetLineTraceEnd()); } if (bDrawDebugLine) { DrawDebugLine(GetWorld(), PawnLocation, GetLineTraceEnd(), FColor(255, 0, 0), false, 0.f, 0.f, 10.f); } }
const FVector UGrabber::GetLineTraceEnd() { UpdateTransformData(); return PawnLocation + (PawnRotator.Vector() * Reach); }