After a bunch more experimentation, I’ve got a proof-of-concept implemented as actor components using delegate calls. There’s a virtual base class, [FONT=Courier New]UGestureRecognizerComponent, that keeps track of information about each touch in the gesture. Concrete subclasses use this data to detect if a gesture has happened or is happening.
The delegate calls return a reference to the gesture recognizer, which can be queried for whatever information is needed. A rotation gesture recognizer can be queried for delta angle, for example, or a tap gesture can be queried for how many fingers were involved in the tap, or how many taps there were.
I’m feeling pretty good about this approach, so far. It’s fairly flexible and modular and only requires processing to look for gestures you’re actually interested in. Any gesture you don’t add a recognizer for doesn’t get ticked because it doesn’t exist. Creating new concrete subclasses is relatively easy.
The only thing I don’t like right now is that the gesture recognizer is assuming that it’s been added to an [FONT=Courier New]ACharacter subclass whose controller is an instance of [FONT=Courier New]APlayerController. The reason for that is I wanted to leverage the touch processing that’s already happening in [FONT=Courier New]UPlayerInput. It doesn’t break if it’s not, but it fails to detect any gestures.
Is there a better way to handle this? I looked at creating a subclass of [FONT=Courier New]UPlayerInput, but [FONT=Courier New]Tick is not virtual in that class. Alternatively, is there a way to specify that the component should only be added to [FONT=Courier New]ACharacter instances?