Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
A client-side smooth crouching implementation for Unreal Engine 4.
void AEstPlayer::Tick(float DeltaSeconds)
{
Super::Tick(DeltaSeconds);
UpdateCamera(DeltaSeconds);
}
void AEstPlayer::UpdateCamera(float DeltaSeconds)
{
FVector EyeLocation;
FRotator EyeRotation;
GetActorEyesViewPoint(EyeLocation, EyeRotation);
auto Interp = FMath::VInterpTo(Camera->RelativeLocation, EyeLocation, DeltaSeconds, 24.f);
Camera->SetRelativeLocation(Interp);
Camera->SetRelativeRotation(EyeRotation);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment