Advertisement
Guest User

repl

a guest
Dec 19th, 2020
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void ABasePawn::Tick(float DeltaTime)
  2. {
  3.     Super::Tick(DeltaTime);
  4.  
  5.     // v1.0
  6.     if (DeltaTime < 0.125f)
  7.     {
  8.         DrawDebugLine(GetWorld(), SkeletalMesh->GetComponentLocation(), SkeletalMesh->GetComponentLocation() // redundant
  9.             + FVector(0,0,50), FColor::Red, false, 1.0f, 1, 2.0f); // redundant
  10.         SkeletalMesh->GetRelativeLocation() = SkeletalMesh->GetRelativeLocation() * (1.f - DeltaTime / 0.125f);
  11.         DrawDebugLine(GetWorld(), SkeletalMesh->GetComponentLocation(), SkeletalMesh->GetComponentLocation() // redundant
  12.             + FVector(0,0,50), FColor::Blue, false, 1.0f, 1, 2.0f); // redundant
  13.         GEngine->AddOnScreenDebugMessage(-1, -1.f, FColor::Blue, FString(TEXT("Smoothing: Decaying mesh to root.")));
  14.     }
  15.     else
  16.     {
  17.         SkeletalMesh->GetRelativeLocation() = FVector::ZeroVector;
  18.         GEngine->AddOnScreenDebugMessage(-1, -1.f, FColor::Red, FString(TEXT("Smoothing: Teleported mesh to root.")));
  19.     }
  20.     FVector NewRelTranslation = UKismetMathLibrary::InverseTransformDirection(Capsule->GetComponentTransform(), SkeletalMesh->GetRelativeLocation());
  21.     SkeletalMesh->SetRelativeLocation(NewRelTranslation);
  22.    
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement