Hey there. I’m creating a world map for my game, one that a user can pan around from top down view.
One of the things I want to do is have a UI element, a target reticle, that goes around the border of the screen relative to a position in the world. So, if I have a mission over in the bottom left of the world map, and the user is panning elsewhere (and the UI piece isn’t visible), I want the UI element to be shown in the bottom left edge to show the user the direction of the mission objective.
I have done UI over world objects before using the methods for finding the target, converting the coordinates into the UI space, and then putting my UI object in the position calculated. However, in the case where an object isn’t visible to the camera, does anyone have a code example of how to compute the location?
My initial thought is to obtain a vector from the camera to the world object. I think I can then just worry about the xy of the vector and ignore the z. But from there, I’m stumped.
Any advice appreciate. Thanks.