Snap to each segment
fire opened this issue · comments
Hi I was looking at your code,
Do you know how to make it is snap to each section and provide a line from the center to the cursor?
Hey I'm on a motorcycle tour at the moment but I can give some pointers.
The current index of the cursor is determined by the following function:
godot-radial-menu/addons/radial_menu/CursorPos.gd
Lines 16 to 33 in 6a67b2b
However this is for code logic, to actually render the cursor position we use shader code, which can be found here:
godot-radial-menu/addons/radial_menu/selector.shader
Lines 50 to 63 in 6a67b2b
To snap to Index, you would probably just convert the position of the current degree to snapped percentage based on the number of items you have in your selection. That can be found in this line:
About a line from the center, perhaps you can draw a small diagram to help me understand what you're going for?
If the line should reach the cursor wherever it is on screen, then I would use a canvas layer and just draw that line in a shader.
The Shader in my code only applies to the circle, so it would be easier to use an overlay. Or you could just use a Line2D
node on the overlay layer and set the end point to the mouse position.