- Home /
How to make a world-space UI panel that can find an open position in the world?
Right now in my game I can raycast onto an object and place a little sphere marker on the point that I hit.
I want my little sphere marker to have an accompanying world-space UI panel/canvas that pops up with it and is connected to the marker with a line renderer.
More importantly, I want the UI panel to be able to find an "open" space around the object to float in, so it doesn't accidentally just float in the middle of the object and get obscured. The object can move, so it needs to be able to do this regularly.
Ideally, it shouldn't need to compare against the bounds of just that one object that the marker is placed on, either. I just want to know, "is my panel sitting in empty space, or is it not?" And adjust from there.
Has anyone here ever made something like this?
Not sure regarding the UI part, but I guess you could just use a few https://docs.unity3d.com/ScriptReference/Physics.SphereCast.html going from the Hit point where you spawned the Sphere and outwards to check if there's anything in the way, maybe ?
This is what I ended up doing! And I use $$anonymous$$oveTowards the camera, basically
Your answer
Follow this Question
Related Questions
Load different render textures into Raw image object 0 Answers
Transforming a GameObject with an unattached script 1 Answer
How to change the direction of the RayCast? 2 Answers
how to rotate and transform an Game object using same button in unity ? 0 Answers
Is there a functionality for finding how much two objects intersect each other 2 Answers