x


vector2 is 0 to 1?

I saw the document say vector2's x axis is between 0 and 1.I have a question!Input.GetTouch(i).position is a vector2?right?But I saw Input.GetTouch(i).position.x is between 0 and 480(My mobile screen's size)!Why?And how can I normalize it to vector2's standard 0-1?

more ▼

asked Sep 02 '11 at 01:29 AM

noob22 gravatar image

noob22
48 43 48 49

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

Vector2 x and y components are arbitrary floating-point numbers. A particular function will return values as documented for that specific function. To normalise a Touch position, divide x by Screen.width and y by Screen.height.

more ▼

answered Sep 02 '11 at 01:34 AM

Waz gravatar image

Waz
6.5k 23 33 71

I want to do http://this.It should come out a object where I touched the screen!But the object's position is 0 to 1.Input.GetTouch.position is 0 to my mobile's width. How to do this?

Sep 02 '11 at 01:47 AM noob22

Sorry, but you're really hard to understand.

Sep 02 '11 at 06:43 AM Waz
(comments are locked)
10|3000 characters needed characters left

No, Vector2 is two floats, so x and y have the range of a single-precision float.

more ▼

answered Sep 02 '11 at 01:34 AM

Eric5h5 gravatar image

Eric5h5
81.5k 42 133 529

I want to change x and y have the range of 0 to 1?How to do it?

Sep 02 '11 at 01:37 AM noob22

Maybe you can make vector2 x or y to bigger than 1,but you cannt see your object in camera?

Sep 02 '11 at 01:40 AM noob22
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x915
x606
x501
x47
x18

asked: Sep 02 '11 at 01:29 AM

Seen: 1035 times

Last Updated: Sep 02 '11 at 06:43 AM