Skip to content
Snippets Groups Projects
Commit 231356fb authored by Ehret's avatar Ehret
Browse files

slight performance improvement

parent 586f0f80
Branches
Tags
2 merge requests!28Improve Walking implementation,!13Draft: Improve walking implementation
...@@ -247,11 +247,12 @@ void UVRPawnMovement::ShiftVertically(float Distance, float VerticalAcceleration ...@@ -247,11 +247,12 @@ void UVRPawnMovement::ShiftVertically(float Distance, float VerticalAcceleration
} }
} }
FHitResult UVRPawnMovement::CreateCapsuleTrace(const FVector Start, FVector End, bool DrawDebug) const FHitResult UVRPawnMovement::CreateCapsuleTrace(const FVector Start, FVector End, bool DrawDebug)
{ {
const EDrawDebugTrace::Type DrawType = DrawDebug ? EDrawDebugTrace::Type::ForDuration : EDrawDebugTrace::Type::None; const EDrawDebugTrace::Type DrawType = DrawDebug ? EDrawDebugTrace::Type::ForDuration : EDrawDebugTrace::Type::None;
TArray<AActor*> ActorsToIgnore; if(ActorsToIgnore.Num()==0){
ActorsToIgnore.Add(GetOwner()); ActorsToIgnore.Add(GetOwner());
}
//UE_LOG(LogTemp, Warning, TEXT("Capsule from %s to %s"), *Start.ToString(), *End.ToString()) //UE_LOG(LogTemp, Warning, TEXT("Capsule from %s to %s"), *Start.ToString(), *End.ToString())
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "GameFramework/FloatingPawnMovement.h" #include "GameFramework/FloatingPawnMovement.h"
#include "Components/CapsuleComponent.h" #include "Components/CapsuleComponent.h"
#include "Camera/CameraComponent.h" #include "Camera/CameraComponent.h"
#include "Actor.h"
#include "VRPawnMovement.generated.h" #include "VRPawnMovement.generated.h"
...@@ -64,7 +65,7 @@ public: ...@@ -64,7 +65,7 @@ public:
private: private:
//check for //check for
FHitResult CreateCapsuleTrace(const FVector Start, FVector End, bool DrawDebug=false) const; FHitResult CreateCapsuleTrace(const FVector Start, FVector End, bool DrawDebug=false);
void SetCapsuleColliderToUserSize(); void SetCapsuleColliderToUserSize();
void CheckForPhysWalkingCollision(); void CheckForPhysWalkingCollision();
FVector GetCollisionSafeVirtualSteeringVec(FVector InputVector, float DeltaTime); FVector GetCollisionSafeVirtualSteeringVec(FVector InputVector, float DeltaTime);
...@@ -77,4 +78,7 @@ private: ...@@ -77,4 +78,7 @@ private:
float VerticalSpeed = 0.0f; float VerticalSpeed = 0.0f;
FVector LastCapsulePosition; FVector LastCapsulePosition;
FVector LastSteeringCollisionVector; FVector LastSteeringCollisionVector;
//just stored for performance gains;
TArray<AActor*> ActorsToIgnore;
}; };
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment