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 /
  • Help Room /
This question was closed Oct 17, 2015 at 10:23 AM by meat5000 for the following reason:

A Physics question. not a unity question.

avatar image
1
Question by HellsPlumber · Oct 12, 2015 at 04:58 AM · particlesprojectilearccalculations

Calculating a projectile arc

Hi!

I've been struggling with this concept for months now and getting around it by using a more simple aiming system which only works half of the time.

In my game the player fires liquid projectiles (in the form of particles), thus naturally they arc unlike a bullet so I need the aiming system to compensate for this.

The below image illustrates what I'm trying to accomplish:

alt text

The white Debug Line is a raycast along the gun's line of sight, and is where the player is aiming.

The 3 arcs show how the weapon would need to angle itself in order to shoot each target that the raycast hits. How would I go about calculating this angle?

Thanks in advance for any help/advice!

Comment
Add comment · Show 4
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 HellsPlumber · Oct 16, 2015 at 12:44 AM 0
Share

Sorry to bump, does anyone have any info about this? I'm at a loss and can't progress :(

avatar image meat5000 ♦ · Oct 17, 2015 at 10:25 AM 0
Share

The term you are looking for is "$$anonymous$$inematic Equations".

http://www.physicsclassroom.com/class/1D$$anonymous$$in/Lesson-6/$$anonymous$$inematic-Equations

Using these equations you can work out pretty much anything with regard to projectile motion.

https://www.google.co.uk/search?q=physics+kinematic+equation+projectile+motion&ie=utf-8&oe=utf-8&gws_rd=cr&ei=7SEiVrPpE$$anonymous$$TpUsusuvA$$anonymous$$

https://www.google.co.uk/search?q=coding+projectile+motiont&ie=utf-8&oe=utf-8&gws_rd=cr&ei=NiIiVovON$$anonymous$$eJUcvdhYAD#q=coding+projectile+motion

avatar image HellsPlumber meat5000 ♦ · Oct 17, 2015 at 10:29 AM 0
Share

Thanks for the pointers, it seems to back up Vallvaka's answer. Are you able to convert Vallvaka's formula below into C# equivalent? I'm finding it difficult to convert into code.

avatar image meat5000 ♦ HellsPlumber · Oct 17, 2015 at 11:43 AM 0
Share

This will help

http://docs.unity3d.com/ScriptReference/$$anonymous$$athf.Asin.html

Do note that Sin based functions in Unity are not super-fast so try not to overuse them, like placing multiple sin functions in Update.

Sorry to have to have closed this question, its just not Unity specific.

1 Reply

  • Sort: 
avatar image
1
Best Answer

Answer by Vallvaka · Oct 16, 2015 at 03:44 AM

The angle of a projectile launch (A) with known parameters initial velocity (V), target distance (x), and gravity (g) is given by

A = 0.5 arcsin(gx / V^2)

For example, the angle for a launch at 50 units per second for a target distance of 200 units with gravity of 9.81 units per second is given by

A = 0.5 arcsin(9.81 * 200 / 100^2) = 25.85 degrees

Comment
Add comment · Show 3 · 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 HellsPlumber · Oct 17, 2015 at 10:01 AM 0
Share

Sorry about the image not being visible, I'm not sure why that's happening. I can see it when I'm logged in to Answers, but not when I'm logged out so it's a bit odd. This is the image anyway: https://gyazo.com/dd304c712d87da2f23393b74bf380c77

Thankyou for the help, I'm currently trying it implement it in the game, I'll let you know how it goes!

avatar image Vallvaka HellsPlumber · Oct 21, 2015 at 12:35 AM 0
Share

I assume (and hope) you got it working? I can convert it to C# for you if you still need it.

avatar image HellsPlumber Vallvaka · Oct 21, 2015 at 10:01 AM 0
Share

Sorry I didn't get back to you about that, but yes I got it working thanks to you!

Follow this Question

Answers Answers and Comments

32 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Projectile velocity correction to always hit stationary spot 0 Answers

Enemy throwing projectiles in an arc 1 Answer

Shooting A Projectile With an Arc 0 Answers

FireComplex wont start on triggered collision 1 Answer

how to make particles NOT collide with triggers? 1 Answer


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