Basically I am trying to make objects which are outside my minimap appear on the edge of the map’s circle. (The map overlay is masked with a circle image). The object that I’m trying to manipulate (move to the edge of the circle) is only seen by the map camera, and represents an object in the scene… So I want to move that object to the edge of the circle.
I have figured out how to get a Vector3 that represents the normalized direction to the center of the map (where the main character is). What I can’t figure out is how to get the position of the intersection between a raycast from the object and the edge of a circle centered on the main character. I’m guessing there’s a way to do this without even using a ray or collider? That would be good since a collider that is almost as big as the room that contains my character would cause lots of other problems for me.
I don’t know trigonometry or calculus or whatever is required to understand how to solve that problem. I wish I had taken more math classes!
Can anyone help me?
TLDR; How do I find the position where a line (direction) from an object intersects a radius surrounding my character?
The Debug.Log line always prints “0” but I thought it should print “1” or my mapRadius value?
Even though the relX and relZ are always 0, the object I intend to move (which has the above script attached to it) does in fact move… but it moves diagonally based on the character’s x position. It does not constrain to a circle.