Trying to teleport my character to mouse position (2d with perspective view)
So whenever i press right click i want my character to teleport to that location so im using this code for that
v3 = Input.mousePosition; v3.z = 10f; v3 = Camera.main.ScreenToWorldPoint(v3); v3.z = 0f; gameobject.transform.position = v3;
This works perfectly in orthographic mode but when im using it in perspective mode i dont get teleported to the correct position where my mouse is. Im also using a camera follow script, what do i have to do to fix this problem?
Your answer
Follow this Question
Related Questions
Can't teleport to different scene in the 2D Game Kit 3 Answers
background jitters 2D 8-bit pixel art game 0 Answers
Editing Unity2DCameraFollow to allow for camera offset 1 Answer
ShadowCaster2D is not compatible with Perspective Camera 0 Answers
How to make my look at script work with a perspective camera? (2D) 0 Answers