- Home /
 
Input.mousePosition not updating?
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class MoveFurniture : MonoBehaviour {
 
     void Update()
     {
         Debug.Log(Camera.main.ScreenToWorldPoint(Input.mousePosition));
     }
 
 }
 
               I can't see any changes, it keeps printing (0, 1, -10) which is the camera's position.
Answer by ifdef_ben · May 26, 2017 at 08:49 PM
Have you tried only logging the Input.mousePosition?
   Debug.Log(Input.mousePosition);
 
               I think it's the way you are using the ScreenToWorldPoint() function.
The documentation says that you should use the z value of the vector3 to specify a plane offset from the camera. So if you never change that value and it's stays at 0, then the only "WorldPoint" valid will be the camera position.
Try this instead:
 Vector3 vector = new Vector3(Input.mousePosition.x, Input.mousePosition.y, Camera.main.nearClipPlane);
 Debug.Log(Camera.main.ScreenToWorldPoint(vector));
 
              Your answer
 
             Follow this Question
Related Questions
What is the formula for ScreenToWorldPoint ? 1 Answer
camera display is problem when close google cardboard 0 Answers
Keep the multiple players within the screen 2 Answers
Multiple Cars not working 1 Answer
Camera move when reach edge of screen 3 Answers