Devlog #5 Dynamic Weapon Wheel


Next on the list was to make a weapon wheel, but not just any weapon wheel, a dynamic weapon wheel. By dynamic I mean distributing the wheel icons evenly around the wheel, at run-time. The maths behind a dynamic weapon wheel is relatively simple, just rotate the starting position of item 0 around the wheel center by some amount. The hard part was figuring out how to create the icons at run-time and how to store the item data.

The creation of the wheel icons had me torn between using a button widget, or an image widget. On the one hand, the button widget had hovering built in but from testing having to hover over exactly where the icon was made the wheel finicky to use. Whereas the image approach was easier to manage, but with the obvious disadvantage of not having any hovering capabilities. After figuring out the maths to determine which icon is being pointed at, I decided to use the image widget for each wheel item and manually handle the icon switching between normal and selected.


After getting the creation of the items down, I had to decide which base class to use for storing the wheel item data. Eventually after exploring multiple base classes, the best option was to use the lowest level object possible, the UObject parent class. With this and a WeaponWheel class, inherited from UUserWidget, it was rather trivial to dynamically add the items at run-time and to manually handle the item hovering. All of this combined plus a not-the-best recreation of the icons from Dishonored 2 made for a pretty robust and customizable dynamic weapon wheel.

3 Items

9 Items

Get Ability System

Leave a comment

Log in with itch.io to leave a comment.