Hi I am Anant Shah, I have some issue in my code , I have a MovingPlatform That can rotate as well. I try to set up like , what ever is platfom rotation it dosent meter just add this rotation in my platfom , like Rotation Start + Target , This is my code
void AMovingPlatform::RotatePlatform(float DeltaTime)
{
if (ShouldTargetRotation)
{
Alpha = FMath::Clamp(Alpha + (TargetRotationSpeed * DeltaTime), 0.0f, 1.0f);// clamp use for to between min & max value
FQuat RotatorOffset = FQuat::SlerpFullPath(StartRotationQuat, TargetRotationQuat, Alpha);//for smooth interpolation
SetActorRotation(RotatorOffset);
DrawDebugLine(GetWorld(), GetActorLocation(), GetActorLocation() + GetActorForwardVector() * 100, FColor::Red, false, -1.f);
DrawDebugPoint(GetWorld(), GetActorLocation() + GetActorForwardVector() * 100, 20, FColor::Red, false, -1.0f, 0);
if (Alpha >= 1.0f)
{
ShouldRotate = false;
FQuat S_Rotate = TargetRotationQuat;
FQuat T_Rotate = StartRotationQuat;
StartRotationQuat = S_Rotate;
TargetRotationQuat = T_Rotate;
Alpha = 0.0f;
}
}
else
{
AddActorLocalRotation(RotationVelocity);
DrawDebugLine(GetWorld(), GetActorLocation(), GetActorLocation() + GetActorForwardVector() * 100, FColor::Red, false, -1.f);
DrawDebugPoint(GetWorld(), GetActorLocation() + GetActorForwardVector() * 100, 20, FColor::Red, false, -1.0f, 0);
}
}