I need to implement a custom gamepad navigation system similar to a skill tree. The focusable elements are scattered across the UI, and I want the player to be able to navigate between them in any direction (including diagonally) using the analog stick. Simultaneously, I’d like the D-pad or keyboard to handle a simplified version of this navigation.
What is the best approach to override the default navigation to support this “free-form” directional movement between nodes without relying on a strict grid?
[Attachment Removed]
Hi,
There are three different approaches you could take here:
- We’ve added an experimental navigation mode in 5.7 that you can enable via “Slate.Navigation.Experimental 1” in the console. I don’t think there is any documentation, but this new mode will let you specify a navigation mode on a per-widget basis (proximity or orthogonal) which will be inherited by derived widget classes. If you switch to Proximity, you’ll get some settings you can tune to specify the search angle and how strongly to bias towards widgets that are orthogonal to the source widget. You could play around with that and see if you can get good enough results out of the box, let me know if you need any more info on how those settings work.
- If you want full control, you can set up custom navigation rules for each node in the skill tree. This will be a bit tedious (and analog input will be treated as the closest cardinal direction) but lets you be explicit about how navigation should work.
- You could use FAnalogCursor to drive a virtual cursor, and rely fully on pointer-style inputs for navigating between nodes
I’d give the first option a try since it should be super quick to get it up and running and it’ll handle the analog inputs better. Let me know if you run into any issues!
[Attachment Removed]