Skip to content
Snippets Groups Projects
Commit 928c32c2 authored by Marcel Krüger's avatar Marcel Krüger
Browse files

refactor(pawn): Changes InputMappingContexts to array of IMCs

parent 2de83ac0
No related branches found
No related tags found
2 merge requests!80UE5.3-2023.1-rc2,!69refactor(pawn): Condense IMCs
No preview for this file type
......@@ -78,12 +78,16 @@ void ARWTHVRPawn::NotifyControllerChanged()
// If we are also the authority (standalone or listen server), directly attach it to us.
// If we are not (client), ask the server to do it.
if (HasAuthority())
{
AttachDCRAtoPawn();
}
else
{
ServerAttachDCRAtoPawnRpc();
}
}
}
}
void ARWTHVRPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
......@@ -135,8 +139,10 @@ void ARWTHVRPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponen
}
// bind the current mapping contexts
AddInputMappingContext(PlayerController, CurrentGeneralInputMappingContext);
AddInputMappingContext(PlayerController, CurrentMovementInputMappingContext);
for (const auto& Mapping : InputMappingContexts)
{
AddInputMappingContext(PlayerController, Mapping);
}
}
void ARWTHVRPawn::AddInputMappingContext(const APlayerController* PC, const UInputMappingContext* Context) const
......@@ -183,7 +189,9 @@ void ARWTHVRPawn::EvaluateLivelink() const
HeadSubjectRepresentation.Role, SubjectData);
if (!bHasValidData)
{
return;
}
// Assume we are using a Transform Role to track the components! This is a slightly dangerous assumption, and
// could be further improved.
......
......@@ -32,10 +32,7 @@ public:
virtual void NotifyControllerChanged() override;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Pawn|Input")
UInputMappingContext* CurrentGeneralInputMappingContext;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Pawn|Input")
UInputMappingContext* CurrentMovementInputMappingContext;
TArray<UInputMappingContext*> InputMappingContexts;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Pawn|MotionControllers")
UMotionControllerComponent* RightHand;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment