Comments and answers for "Finding Nearest Object Both Positive And Negative?"
http://answers.unity.com/questions/462486/finding-nearest-object-both-positive-and-negative.html
The latest comments and answers for the question "Finding Nearest Object Both Positive And Negative?"Comment by Rybo5000 on Rybo5000's answer
http://answers.unity.com/comments/463396/view.html
Perfect, I should've realised that! Thank you!Sun, 26 May 2013 09:22:50 GMTRybo5000Answer by robertbu
http://answers.unity.com/answers/462545/view.html
Vector3.Distance is unsigned, so you problem is not an issue with "positive direction." You issues is that Input.mousePosition is in screen coordinates. Screen coordinates go from (0,0) in the lower left of your game to (Screen.width, Screen.height) in the upper right. In order to do the calculation you need to convert your mouse position into a world coordinates.
World coordinates are in 3D space, so to make the conversion, you have have to decide about how far in front of the camera you want the point. I'm going to assume your camera is looking down the 'Z' axis, and since all of your arrow Vector3 values have a 'z' coordinate of '0', you want the point at the origin:
Vector3 v3Pos = new Vector3(Input.mousePosition.x, Input.mousePosition.y, Mathf.Abs(Camera.main.transform.position.z));
v3Pos = Camera.main.ScreenToWorldPoint(v3Pos);
After the this conversion, you can use v3Pos in place of your Input.mousePosition in all of your Vector3.Distance() calls.Fri, 24 May 2013 12:47:21 GMTrobertbu