In the process of making my dialogue system, I’ve connected the Axis Mappings of both the X and Y axes to character movement as well as cursor movement. However, because of the continuous signal of Axis Mappings, the selection cursor becomes much too sensitive, as it will rapidly flicker between different choices. Here is the relevant code:
In APlayerUnitController.cpp:
if (PlayerUI.IsValid())
{
if (PlayerUI->ActiveWidget.IsValid())
{
PlayerUI->ActiveWidget->MoveCursorY(AxisValue);
}
}
And SDialogueBox.cpp:
if (AxisValue >= 1.0f)
{
ChoiceEntryWidget->MoveCursorUp();
}
else if (AxisValue <= -1.0f)
{
ChoiceEntryWidget->MoveCursorDown();
}
MoveCursorUp() and MoveCursorDown() share similar code:
ChoicesArray[CurrentIndex]->ToggleSelection(false);
if (CurrentIndex != 0)
{
CurrentIndex--;
ChoicesArray[CurrentIndex]->ToggleSelection(true);
}
else
{
CurrentIndex = LastValidIndex;
ChoicesArray[CurrentIndex]->ToggleSelection(true);
}
Where the conditions are simply reversed for MoveCursorDown(). Even checking that AxisValue is at 1 or -1 does not stop the cursor from flickering. I’ve tried using a timer with a delegate, but even that doesn’t seem to solve the problem.