Before updating to Windows 10 you may need to return your Pro license. More information here

Update EmptyGameObject Rotation to MousePosition

Why doesn't this seem to work?

function Update (){

This script is attached to the PrefabSpawnPoint I would like to rotate toward where I click on the screen.

This seems to be the simplest solution, but not working.

more ▼

asked Jan 30, 2011 at 04:11 AM

avatar image

Adam 10
52 36 30 32

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

1 answer: sort voted first

Input.mousePosition is not a place in the world; it's a place on your screen.


more ▼

answered Jan 30, 2011 at 04:22 AM

avatar image

19.1k 212 203 317

Yeah, I just found that out, I think I have it close, I will post my solution when I get it. Thanks.

Jan 30, 2011 at 06:38 AM Adam 10

So, I took the LookAtMouse script from the Wiki and then instead of constantly updating the script I just call the function when I click the left mouse button. This rotates my barrel in the direction I would like to fire. This cause me a new problem, but I will ask a separate question. Thanks.

Jan 30, 2011 at 10:34 PM Adam 10
(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



Answers and Comments



asked: Jan 30, 2011 at 04:11 AM

Seen: 1262 times

Last Updated: Jan 30, 2011 at 04:11 AM