- Home /
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.
You may need to give more detail here about what you need to achieve. Where do the missiles fire from, the camera?
$$anonymous$$issiles Fire from under the plane's wings, and i want them to fire to the position of the mouse pointer.
is it an overhead view? a view from the plane's cockpit? you still need to provide more information.
Answer by StephanK · May 14, 2010 at 04:54 PM
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.
Your answer
Follow this Question
Related Questions
Airplane Control, Aim ... Lerp and Vectors 0 Answers
How to make a projectile in the finger/mouse position in a 2D endless runner? 0 Answers
2d mouse aim shoot bullet 1 Answer
SideScrolling Mouse Pointer Aim - Help 0 Answers
Side Scrolling Shooter. How to aim my bullet trajectory at the mouse cursor? 2 Answers