Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

something about the Camera.ScreenToWorldPoint(Vector3 pos)

Discussion in 'Scripting' started by GinsoneWin, Jan 4, 2015.

  1. GinsoneWin

    GinsoneWin

    Joined:
    Dec 15, 2014
    Posts:
    36
    hi ,everyone ,here is my code piece:
    Code (CSharp):
    1. void FixedUpdate () {
    2.        Vector3 rawPosition =Camera.main.ScreenToWorldPoint(Input.mousePosition);
    3.        print (rawPosition);
    4.    }
    this script is attached to a simple cube.
    here is the question:
    the output is a fixed value instread of changing by movement of my mouse,could anyone tell me what happens?
    by the way,that fixed value is the location of my MainCamera

    this is my second time to post it....waitting for you guys:(
     
  2. Fluzing

    Fluzing

    Joined:
    Apr 5, 2013
    Posts:
    815
  3. GinsoneWin

    GinsoneWin

    Joined:
    Dec 15, 2014
    Posts:
    36