diff --git a/Source/RWTHVRToolkit/Private/Pawn/VRPawnMovement.cpp b/Source/RWTHVRToolkit/Private/Pawn/VRPawnMovement.cpp index 59da4c3d05c9beb82a1a955e17a6caba3f205741..84708a507faae0d5ca43e68f096759519aa9f0cb 100644 --- a/Source/RWTHVRToolkit/Private/Pawn/VRPawnMovement.cpp +++ b/Source/RWTHVRToolkit/Private/Pawn/VRPawnMovement.cpp @@ -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; - TArray<AActor*> ActorsToIgnore; - ActorsToIgnore.Add(GetOwner()); + if(ActorsToIgnore.Num()==0){ + ActorsToIgnore.Add(GetOwner()); + } //UE_LOG(LogTemp, Warning, TEXT("Capsule from %s to %s"), *Start.ToString(), *End.ToString()) diff --git a/Source/RWTHVRToolkit/Public/Pawn/VRPawnMovement.h b/Source/RWTHVRToolkit/Public/Pawn/VRPawnMovement.h index 53ea5ecd0e904a36db1c737f8f017a15effa2585..275bbb349d829b23d116ca4ad8ad1a34ecb89946 100644 --- a/Source/RWTHVRToolkit/Public/Pawn/VRPawnMovement.h +++ b/Source/RWTHVRToolkit/Public/Pawn/VRPawnMovement.h @@ -4,6 +4,7 @@ #include "GameFramework/FloatingPawnMovement.h" #include "Components/CapsuleComponent.h" #include "Camera/CameraComponent.h" +#include "Actor.h" #include "VRPawnMovement.generated.h" @@ -64,7 +65,7 @@ public: private: //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 CheckForPhysWalkingCollision(); FVector GetCollisionSafeVirtualSteeringVec(FVector InputVector, float DeltaTime); @@ -77,4 +78,7 @@ private: float VerticalSpeed = 0.0f; FVector LastCapsulePosition; FVector LastSteeringCollisionVector; + + //just stored for performance gains; + TArray<AActor*> ActorsToIgnore; };