x


Get position of mouse aim to world?

How would I go about getting what position my mouse is pointing in a game environment? For example, if I'm pointing at the foot of a tree at position (100,50,0), how would I make it get the position of (100,50,0) or where the mousever the mouse would hit?

more ▼

asked Apr 23 '11 at 06:14 PM

Arch 1 gravatar image

Arch 1
21 4 4 10

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

1 answer: sort voted first

Search first. Ask if you get stumped.

more ▼

answered Apr 23 '11 at 07:18 PM

flaviusxvii gravatar image

flaviusxvii
3k 13 19 43

Exactly. This is one of the most answered questions out there.

Apr 23 '11 at 07:20 PM Joshua

I'm aware of Input.mousePosition. What I'm trying to do at the moment is get the position the cursor is aiming at. And I've been searching for an answer for about an hour. Mind cluing me in?

Apr 23 '11 at 08:01 PM Arch 1

I've tried to teach you to fish (google search).. but this time i'll just throw the fish at ya. http://unity3d.com/support/documentation/ScriptReference/Camera.ScreenToWorldPoint.html

Learn to search though!

Apr 23 '11 at 08:16 PM flaviusxvii
(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:

x3331
x983
x887
x118
x103

asked: Apr 23 '11 at 06:14 PM

Seen: 3987 times

Last Updated: Apr 23 '11 at 06:14 PM