When using the “Mouse X” in the Third Person Characters, it gives me a value between -1 and 1 accordingly to my mouse moving.
I want to use something similar on my inventory page widget, while I have my inventory open, the problem is, when I open my inventory the value is equal to 0, doesn’t matter how much I move it.
Now when I click it stops getting the values from the movement. Is there a way to keep getting the values? As I want to rotate my object when it’s clicked and held down.
What are you clicking? A button? Something outside the widget? An unhandled click will be passed back to the player controller and the widget will lose focus. This is intentional but can be intercepted.
As I want to rotate my object when it’s clicked and held down.
Could you explain what that object is? Another widget? It’s hard to imagine what the end goal is. Are we inspecting an item?
I am using a Render Target to capture a copy of my character and render it to a Image set as child of an button.
When I click and hold this button I want to make the copy of my character rotate in the same direction of the mouse. I have all the rotation working, my problem now is the dragging.
I think it’s clear now - you need the mouse delta reported in the widget while the mouse button is held down. You kind of explained it well before, it just did not click with me.
ensure the root of the widget is focusable
run in UI Only mode (optional but since we’re in the inventory we might as well)
Try it with the whole widget override instead. Otherwise the image may just handle it and the mouse move will never see it again. But if you do it for the entire widget, the input has nowhere else to go.
The problem with this method of on MouseButtonDown and Up is when you click on the image and move the mouse away from the widget, then release, it will not detect the onMouseButtonUp event and the Boolean will remain true.
You can use the onMouseLeave event but it’s counter-intuitive a bit.
Any clue how to keep this event even if the mouse left the widget area and released the button?
I tried using a “transparent” button over the whole image and using his events which works perfectly but it consumes the onMouseMove event.