Door not stopping

Has anyone else experienced that if the initialYaw + targetYaw > 180 the door will infinitely flip?

Yes, at certain rotations the values might cross 180/-180 because the lecture sets actor rotation rather than relative (which, given the lecture title, I thought it might touch on the subject).

So instead:

Door->SetRelativeRotation(FMath::Lerp(FQuat(CurrentYaw), FQuat(FRotator(0.0f, TargetYaw, 0.0f)), 0.02f /* speed */));   

Privacy & Terms