|
So I have been trying to narrow out some errors in mouse track with where you click and the normalized coordinates produced. EG, the left is 0 right is 1, center is 0.9. It exponentially decreases the amount it changes. Ive made my own normalization function, but I would also like to know what i am doing wrong I hate that I'm reinventing the wheel.
(comments are locked)
|
|
In general: normalizing is almost always the same procedure. Just divide the value by the maximum-range. If the x-coordinate goes from 0 to Screen.width just divide by Screen.width...
(comments are locked)
|
|
Its a property within the Input.mousePosition class so really this is the code to show me the information. Debug.Log(Input.mousePosition.normalized.ToString()); You can try Input.mosuePosition.Normalize(); however Input.mousePosition.normalized produces the same results if you use that method. I already made my own Normalized coordinate its not hard. However the unity function built into the mousePosition class is wrong. EG the reason for this post wondering if anyone else used the Unity Method to do this instead of writing their own. Kindly notice that mousePosition is a VECTOR3!!!!!!!!!!!!.. just normalizing it will probably not behave the way you think.
Jul 20 '11 at 08:34 PM
flaviusxvii
Exactly, Normalize or notmalized will normalize the Vector3 or Vector2 to the length of 1.0 It will be always 1.0 just the direction is preserved. But that takes all 3 axis into account. normalized will just divide each component by the length of the vector so the length becomes 1.0f 2D example: Vector2(5,7) the length of this vector is To get the normalized mouseposition you have to normalize each component seperately. x coord divided by Screen.width and y coord divided by Screen.height.
Jul 20 '11 at 09:38 PM
Bunny83
Ohh, and don't post comments as answers. There's a comment button for that. Answers should answer the question.
Jul 20 '11 at 09:39 PM
Bunny83
(comments are locked)
|

And where's the code? Or should we start guessing? Also i don't quite get what you really want. Do you want "normal" normalized coordinates (0..1 linear) or do you want them to be some kind of exponential?
Right. Center would be .5 unless doing something non-linear, like exponential. Some code would be real helpful.