Skip to content
Snippets Groups Projects
Commit c06bd998 authored by David Gilbert's avatar David Gilbert :bug:
Browse files

Merge branch 'feature/toolkit_examples' into 'dev/5.3'

ContentExample-themed ToolkitExamples map.

See merge request !77
parents 2824b67a fbadc9e5
No related branches found
No related tags found
2 merge requests!80UE5.3-2023.1-rc2,!77ContentExample-themed ToolkitExamples map.
Pipeline #372899 passed
Showing
with 26 additions and 9 deletions
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
No preview for this file type
No preview for this file type
File deleted
...@@ -342,19 +342,18 @@ TOptional<FVector> UCollisionHandlingMovement::GetOverlapResolveDirection() cons ...@@ -342,19 +342,18 @@ TOptional<FVector> UCollisionHandlingMovement::GetOverlapResolveDirection() cons
{ {
TArray<UPrimitiveComponent*> OverlappingComponents; TArray<UPrimitiveComponent*> OverlappingComponents;
TArray<TEnumAsByte<EObjectTypeQuery>> traceObjectTypes; TArray<TEnumAsByte<EObjectTypeQuery>> traceObjectTypes;
traceObjectTypes.Add(UEngineTypes::ConvertToObjectType(ECollisionChannel::ECC_Visibility));
// Ideally we would overlap with ECC_Visibility, but there is no object type this can be converted to that I know
// of. This returns everything, even triggers etc that are *not* visible, which is why we further check for a
// visibility trace and blocking hits.
traceObjectTypes.Add(EObjectTypeQuery::ObjectTypeQuery_MAX);
UKismetSystemLibrary::CapsuleOverlapComponents(GetWorld(), CapsuleColliderComponent->GetComponentLocation(), UKismetSystemLibrary::CapsuleOverlapComponents(GetWorld(), CapsuleColliderComponent->GetComponentLocation(),
CapsuleColliderComponent->GetScaledCapsuleRadius(), CapsuleColliderComponent->GetScaledCapsuleRadius(),
CapsuleColliderComponent->GetScaledCapsuleHalfHeight(), CapsuleColliderComponent->GetScaledCapsuleHalfHeight(),
traceObjectTypes, nullptr, ActorsToIgnore, OverlappingComponents); traceObjectTypes, nullptr, ActorsToIgnore, OverlappingComponents);
if (OverlappingComponents.Num() == 0) TOptional<FVector> ResolveVector;
{
// return unset optional
return TOptional<FVector>();
}
FVector ResolveVector = FVector::ZeroVector;
// check what to do to move out of these collisions (or nothing if none is there) // check what to do to move out of these collisions (or nothing if none is there)
// we just add the penetrations so in very unfortunate conditions this can become problematic/blocking but for now // we just add the penetrations so in very unfortunate conditions this can become problematic/blocking but for now
// and our regular use cases this works // and our regular use cases this works
...@@ -362,7 +361,13 @@ TOptional<FVector> UCollisionHandlingMovement::GetOverlapResolveDirection() cons ...@@ -362,7 +361,13 @@ TOptional<FVector> UCollisionHandlingMovement::GetOverlapResolveDirection() cons
{ {
FHitResult Hit = CreateCapsuleTrace(CapsuleColliderComponent->GetComponentLocation(), FHitResult Hit = CreateCapsuleTrace(CapsuleColliderComponent->GetComponentLocation(),
OverlappingComp->GetComponentLocation(), false); OverlappingComp->GetComponentLocation(), false);
ResolveVector += Hit.ImpactNormal * Hit.PenetrationDepth;
if (Hit.bBlockingHit)
{
FVector Change = Hit.ImpactNormal * Hit.PenetrationDepth;
ResolveVector = ResolveVector.IsSet() ? ResolveVector.GetValue() + Change : Change;
} }
}
return ResolveVector; return ResolveVector;
} }
...@@ -93,6 +93,8 @@ void ARWTHVRPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponen ...@@ -93,6 +93,8 @@ void ARWTHVRPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponen
{ {
Super::SetupPlayerInputComponent(PlayerInputComponent); Super::SetupPlayerInputComponent(PlayerInputComponent);
ActivePlayerInputComponent = PlayerInputComponent;
APlayerController* PlayerController = Cast<APlayerController>(GetController()); APlayerController* PlayerController = Cast<APlayerController>(GetController());
if (!PlayerController) if (!PlayerController)
{ {
...@@ -145,6 +147,9 @@ void ARWTHVRPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponen ...@@ -145,6 +147,9 @@ void ARWTHVRPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponen
} }
} }
UInputComponent* ARWTHVRPawn::GetPlayerInputComponent() { return ActivePlayerInputComponent; }
void ARWTHVRPawn::AddInputMappingContext(const APlayerController* PC, const UInputMappingContext* Context) const void ARWTHVRPawn::AddInputMappingContext(const APlayerController* PC, const UInputMappingContext* Context) const
{ {
if (Context) if (Context)
......
...@@ -19,6 +19,7 @@ class RWTHVRTOOLKIT_API UMovementComponentBase : public UActorComponent, public ...@@ -19,6 +19,7 @@ class RWTHVRTOOLKIT_API UMovementComponentBase : public UActorComponent, public
public: public:
// Already sets up VRPawn and InputSubsystem properties that can be used by child classes. // Already sets up VRPawn and InputSubsystem properties that can be used by child classes.
UFUNCTION(BlueprintCallable)
virtual void SetupPlayerInput(UInputComponent* PlayerInputComponent) override; virtual void SetupPlayerInput(UInputComponent* PlayerInputComponent) override;
protected: protected:
......
...@@ -87,6 +87,9 @@ protected: ...@@ -87,6 +87,9 @@ protected:
virtual void SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) override; virtual void SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) override;
void AddInputMappingContext(const APlayerController* PC, const UInputMappingContext* Context) const; void AddInputMappingContext(const APlayerController* PC, const UInputMappingContext* Context) const;
UFUNCTION(BlueprintCallable)
UInputComponent* GetPlayerInputComponent();
/* LiveLink helper function called on tick */ /* LiveLink helper function called on tick */
void EvaluateLivelink() const; void EvaluateLivelink() const;
...@@ -109,4 +112,7 @@ protected: ...@@ -109,4 +112,7 @@ protected:
/* Set device specific motion controller sources (None, L/R, Livelink) */ /* Set device specific motion controller sources (None, L/R, Livelink) */
void SetupMotionControllerSources(); void SetupMotionControllerSources();
private:
UInputComponent* ActivePlayerInputComponent;
}; };
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment