Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by HolBol · May 14, 2010 at 03:44 PM · mouseprojectileaim

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

Comment
Add comment · Show 6
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Novodantis 1 · May 14, 2010 at 04:02 PM 0
Share

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

avatar image HolBol · May 14, 2010 at 04:20 PM 0
Share

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

avatar image duck ♦♦ · May 14, 2010 at 04:26 PM 0
Share

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

avatar image HolBol · May 14, 2010 at 04:32 PM 0
Share

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

avatar image oinkoinkflapflap · Jan 29, 2011 at 09:28 PM 0
Share

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

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
2

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.

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image HolBol · May 14, 2010 at 06:53 PM 1
Share

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

avatar image Joey · Jun 25, 2010 at 09:49 PM 1
Share

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

avatar image fireDude67 Joey · Jul 08, 2010 at 07:16 PM 0
Share

An example would be nice here too

avatar image Jonathon82931 · Jul 11, 2013 at 11:37 PM 0
Share

this is not an answer

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges