How to move a UI element using Mouse Position in 3D World Space?
![alt text][1]
Hi. I have been trying to experiment with moving UI Elements using the position of the mouse, Trying to make it behave like a cursor. I was able to move the Element when the Canvas Render Mode was set to "Screen Space". I was able to clamp it within the Canvas as well.
But I want it to work when the Canvas Render Mode is "World Space" as well. If I use the same code that I used for the Screen Space, the Element leaves its boundaries and gets messed up as the angles are being varied.
I really need help. Any clue how to do it?
You can view how the scene looks in this image below. [1]: https://img.techpowerup.org/200624/screen.png
If Raycasting is the solution, can someone please help me out and provide a snippet of code or something.
I’m running into similar problems. Doing something as simple as using the mouse to drag/drop the UI is turning into nightmare of conversions between Screen Space, then UI Canvas space, then World Space. Unity doesn’t seem to have built this into their code base, and the online solutions I’ve found aren’t working in my situation. Any tips would be helpful.
Your answer
Follow this Question
Related Questions
Mouse Events with Render Texture 0 Answers
Depth of field not working properly with World Space Canvas 1 Answer
Canvas items using World Space, not Screen Space overlay 0 Answers
Hololens HUD 0 Answers