- Home /
Change position in my scene based on a click on a 2d topdown map texture?
Hi Guy, I am looking to create the option of having a 2d topdown map texture of my overall scene, allow the user to click somewhere on the 2d map and based on this click for the firstperson to jump to this location in the 3d scene, Can any one help me with this?
Thanks in advance, James.
Answer by Tourist · Dec 13, 2012 at 03:45 PM
When the user click on the minimap, you can get the mouse position using Event.current.mouseposition. Make it relative to the drawing rectangle of your minimap (in float [0;1] for each axis).
Then get the gameobject that represents the floor and get its bounding box. Use the values of the bounding box to move the character in the correct location.
for the Y value, you may want to use Physics.Raycast to get the actual position on the gound.