void UMovementComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction)
{
	Super::TickComponent(DeltaTime, TickType, ThisTickFunction);

	// Don't hang on to stale references to a destroyed UpdatedComponent.
	if (UpdatedComponent != NULL && UpdatedComponent->IsPendingKill())
	{
		SetUpdatedComponent(NULL);
	}
}
void UMovementComponent::InitializeComponent()
{
	TGuardValue<bool> InInitializeComponentGuard(bInInitializeComponent, true);
	Super::InitializeComponent();

	USceneComponent* NewUpdatedComponent = NULL;
	if (UpdatedComponent != NULL)
	{
		NewUpdatedComponent = UpdatedComponent;
	}
	else if (bAutoRegisterUpdatedComponent)
	{
		// Auto-register owner's root component if found.
		AActor* MyActor = GetOwner();
		if (MyActor)
		{
			NewUpdatedComponent = MyActor->GetRootComponent();
		}
	}

	SetUpdatedComponent(NewUpdatedComponent);
}
void UProjectileMovementComponent::StopSimulating(const FHitResult& HitResult)
{
	SetUpdatedComponent(NULL);
	Velocity = FVector::ZeroVector;
	OnProjectileStop.Broadcast(HitResult);
}
void UInterpToMovementComponent::StopSimulating(const FHitResult& HitResult)
{
	SetUpdatedComponent(nullptr);
	Velocity = FVector::ZeroVector;
	OnInterpToStop.Broadcast(HitResult, CurrentTime);
}