Last active
March 27, 2022 02:09
-
-
Save alanedwardes/aba1ad897b94d02a0fe3033fb48c8d42 to your computer and use it in GitHub Desktop.
A client-side smooth crouching implementation for Unreal Engine 4.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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