x


fire towards mouse pointer

I have a plane, and i need a script so a the missiles will always fire to where the mouse pointer is. How would i do this.? The projectiles fire from where the missiles are on the plane, and I want them to fire in the direction the cursor is pointing. Plane

more ▼

asked May 14 '10 at 03:44 PM

Fishman92 gravatar image

Fishman92
2.4k 101 113 128

You may need to give more detail here about what you need to achieve. Where do the missiles fire from, the camera?

May 14 '10 at 04:02 PM Novodantis 1

Missiles Fire from under the plane's wings, and i want them to fire to the position of the mouse pointer.

May 14 '10 at 04:20 PM Fishman92

is it an overhead view? a view from the plane's cockpit? you still need to provide more information.

May 14 '10 at 04:26 PM duck ♦♦

Overhead view, from behind the plane. I'll post a pic.

May 14 '10 at 04:32 PM Fishman92

i'm just saying... that game looks awesome!!

Jan 29 '11 at 09:28 PM oinkoinkflapflap
(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

Using Camera.ScreenPointToRay and doing a raycast will get you the point on the plane. All you need to do then is point - firingPosition and you will have the direction in which to fire your missile.

more ▼

answered May 14 '10 at 04:54 PM

StephanK gravatar image

StephanK
6k 39 53 93

Don't have a clue how to implement this... any examples?

May 14 '10 at 06:53 PM Fishman92
(comments are locked)
10|3000 characters needed characters left

can you give an example because this wil really help me too

more ▼

answered Jun 25 '10 at 09:49 PM

Joey gravatar image

Joey
42 10 13 15

An example would be nice here too

Jul 08 '10 at 07:16 PM fireDude67
(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:

x984
x254
x103

asked: May 14 '10 at 03:44 PM

Seen: 2707 times

Last Updated: May 14 '10 at 04:34 PM