x


What object is character looking at

I am trying to find out what object the character is currently looking at and the face of the object they are looking at. I will have a cross hair in the center of the screen and when they mouse over certain objects i want to be able to react certain ways.

more ▼

asked Jun 02 '10 at 12:41 AM

Jason 6 gravatar image

Jason 6
36 4 4 8

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

1 answer: sort voted first

What you want to do is take a look at the Physics.Raycast function. It basically draws an "invisible line" from a point on the screen outward, and returns the first thing it hits.

more ▼

answered Jun 02 '10 at 02:12 AM

qJake gravatar image

qJake
11.6k 43 78 161

Thank you this worked perfect

Jun 02 '10 at 05:14 AM Jason 6
(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:

x5049
x1524
x179

asked: Jun 02 '10 at 12:41 AM

Seen: 1231 times

Last Updated: Jun 02 '10 at 09:11 AM