microsoft / MixedReality-UXTools-Unreal

UX tools and components for developing Mixed Reality applications in UE4.
https://microsoft.github.io/MixedReality-UXTools-Unreal/
MIT License
316 stars 86 forks source link

Correction for simulated movement with enhanced input in public/0.12.x-UE5.1 #74

Open lynconEBB opened 11 months ago

lynconEBB commented 11 months ago

I encountered some frustration with the camera and hands movement while using the simulated features. Upon delving into the code, I discovered that the AXRSimulationActor's Input actions were utilizing UInputTriggerDown triggers. These triggers processed input only when passing a 0.5 threshold, which proved less than ideal for achieving precise movement.

To address this, I propose a modification: refrain from adding the UInputTriggerDown trigger when creating the Input actions in the XRSimulationActor.cpp file. This adjustment ensures a smoother and more accurate user experience.

File: XRSimulationActor.cpp

void AXRSimulationActor::RegisterEnhancedInputAxis(UInputAction*& Action, FText Description, TArray<FKey> Keys, bool Negate)
{
    Action = NewObject<UInputAction>();
    Action->AddToRoot();

    Action->ActionDescription = Description;
    // Remove this line
        // Action->Triggers.Add(NewObject<UInputTriggerDown>());
    Action->bConsumeInput = false;
    Action->ValueType = EInputActionValueType::Axis1D;

    if (Negate)
    {
        Action->Modifiers.Add(NewObject<UInputModifierNegate>());
    }

    for (FKey Key : Keys)
    {
        InputMappingContext->MapKey(Action, Key);
    }
}

void AXRSimulationActor::RegisterEnhancedInputAction(UInputAction*& Action, FText Description, TArray<FKey> Keys)
{
    Action = NewObject<UInputAction>();
    Action->AddToRoot();

    Action->ActionDescription = Description;
    // Remove this line
        // Action->Triggers.Add(NewObject<UInputTriggerDown>());
    Action->bConsumeInput = false;

    for (FKey Key : Keys)
    {
        InputMappingContext->MapKey(Action, Key);
    }
}