diff --git a/EndlessVendetta/Content/Levels/OpenWorldRework.umap b/EndlessVendetta/Content/Levels/OpenWorldRework.umap index 5779b05f..1846fbaf 100644 --- a/EndlessVendetta/Content/Levels/OpenWorldRework.umap +++ b/EndlessVendetta/Content/Levels/OpenWorldRework.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f0ae225c75435b7274413df74369f3a787fed121edcf9ee137b2203c0e968d6a -size 91723991 +oid sha256:4f7f440c21c6b74315cc8561bae279679ac4a7ca73c5df78bd78a519849a989d +size 91723943 diff --git a/EndlessVendetta/Source/EndlessVendetta/SpaceShip/SpaceShip.cpp b/EndlessVendetta/Source/EndlessVendetta/SpaceShip/SpaceShip.cpp index 2516e7bf..4f33440b 100644 --- a/EndlessVendetta/Source/EndlessVendetta/SpaceShip/SpaceShip.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/SpaceShip/SpaceShip.cpp @@ -75,22 +75,17 @@ void ASpaceShip::BikeElevationPhysics(float DeltaTime) CollisionQueryParams.AddIgnoredActor(this); FVector LT_Start = GetActorLocation(); LT_Start.Z += 150; - FVector LT_End = LT_Start + FVector(0, 0, -450); + FVector LT_End = LT_Start + FVector(0, 0, -750); if (GetWorld()->LineTraceSingleByChannel(OutHit, LT_Start, LT_End, ECC_WorldStatic, CollisionQueryParams)) { HighestElevationPoint = OutHit.Location.Z; } - DrawDebugPoint(GetWorld(), OutHit.Location, 50, FColor::Red); - DrawDebugLine(GetWorld(), LT_Start, LT_End, FColor::Red, false, -1, 0, 5); LT_Start = UKismetMathLibrary::TransformLocation(GetActorTransform(), FVector(MovementOffsetForLT[MovementVec.Y] ,MovementOffsetForLT[MovementVec.X], 150)); - LT_End = LT_Start + FVector(0, 0, -600); + LT_End = LT_Start + FVector(0, 0, -750); if (GetWorld()->LineTraceSingleByChannel(OutHit, LT_Start, LT_End, ECC_WorldStatic, CollisionQueryParams) && OutHit.Distance != 0) { HighestElevationPoint = OutHit.Location.Z; - UE_LOG(LogTemp, Warning, TEXT("valid point")); } - DrawDebugPoint(GetWorld(), OutHit.Location, 50, FColor::Green); - DrawDebugLine(GetWorld(), LT_Start, LT_End, FColor::Green, false, -1, 0, 5); if (HighestElevationPoint <= -99999998) { float GravityAcc = 9.81 * DeltaTime; @@ -101,10 +96,13 @@ void ASpaceShip::BikeElevationPhysics(float DeltaTime) SetActorLocation(NewLoc, true); return; } - if (CurrentFallSpeed > 0) - { - CurrentFallSpeed = 0; - } + float TargetElevation = HighestElevationPoint + HoverHeight; + float DistanceToTarget = TargetElevation - GetActorLocation().Z; + float IncrementToTarget = DistanceToTarget * DeltaTime * 2; + FVector CurrentActorLoc = GetActorLocation(); + CurrentActorLoc.Z += IncrementToTarget; + SetActorLocation(CurrentActorLoc, true); + CurrentFallSpeed = 0; } // Called every frame diff --git a/EndlessVendetta/Source/EndlessVendetta/SpaceShip/SpaceShip.h b/EndlessVendetta/Source/EndlessVendetta/SpaceShip/SpaceShip.h index 95beb1b4..dab05f0a 100644 --- a/EndlessVendetta/Source/EndlessVendetta/SpaceShip/SpaceShip.h +++ b/EndlessVendetta/Source/EndlessVendetta/SpaceShip/SpaceShip.h @@ -28,6 +28,7 @@ class ENDLESSVENDETTA_API ASpaceShip : public ACharacter TMap MovementOffsetForLT; float CurrentFallSpeed = 0; float TerminalFallSpeed = 100; + float HoverHeight = 50; FVector2D MovementVec; USpringArmComponent* BikeParentComp;