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
0
Question by PanzerPotato · Jun 14, 2018 at 03:17 AM · physicsaiaiminggunsturrets

Shell Drop and Aiming

Hello everyone, I am currently in the process of developing a game which involves shore guns firing at targets over a long distance. These guns can already rotate towards a clamped angle and elevate their guns to look at a target. However, I intend to have a form of non-linear "bullet drop" for the shells, and thus the guns will have to aim higher so the shell will actually drop on the target (dispersion I have already taken care of). So here are my issues:

  1. I'm not sure how to give my shells a parabolic drop (no other influences, ex. wind), and

  2. How my guns can compensate for the drop (Important: my batteries should elevate their guns to compensate, not reduce velocity).

Any thoughts or comments would be greatly appreciated!

Edit: My projectiles and targets are both rigidbodies.

Comment
Add comment · Show 1
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 PanzerPotato · Jun 15, 2018 at 12:43 AM 0
Share

Correction: I am intending to create a simple parabolic drop for projectiles, with varying velocities. I have also seen a snippet of code allowing the guns to aim higher to compensate for drop, but I am not sure how to implement it.

  aimPosition = targetPosition + Vector.up * dropCurve.Evaluate( distanceToTarget );


Thanks!

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by incorrect · Jun 14, 2018 at 06:11 PM

If your projectiles are rigidbodies and not marked as kinematic, it means they will be affected by the gravity and will naturally fall down causing that parabolic trajectory. Also you can apply a vertical force to them in FixedUpdate to create that curve. The implementation really depends on the desired behaviour.

And about the second part of your question: you literally have to calculate trajectory before the shot taking into account the time of projectile's travel to target and the parabolic fall.

Comment
Add comment · Show 6 · 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 PanzerPotato · Jun 14, 2018 at 06:40 PM 0
Share

Could you suggest any sort of equation or how I would calculate this? (I'm still a bit of a newcomer to unity :D)

avatar image incorrect PanzerPotato · Jun 14, 2018 at 10:15 PM 0
Share

I don't have any equation for you. You should figure it out yourself. And it's not Unity-specific, it's general math, so be ready to go head-first dive into how it works.

avatar image PanzerPotato · Jun 14, 2018 at 09:02 PM 0
Share

Additionally, would the projectile need it's own script, or would the gun do the work?

avatar image incorrect PanzerPotato · Jun 14, 2018 at 10:16 PM 0
Share

You can make gun's script do all the work, but that will result in many problems you will face in future development, if there will be any. Read about the concepts of OOP, it will help you to understand how things work.

avatar image PanzerPotato incorrect · Jun 15, 2018 at 01:26 AM 0
Share

Sorry, but I'm not sure how a OOP relates to ai$$anonymous$$g and parabolas...

Show more comments

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

197 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 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 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 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 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 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 avatar image avatar image avatar image avatar image avatar image

Related Questions

AI rigidboy aiming 0 Answers

AI Turret Aiming 2 Answers

Thief Car AI for 3D Game 0 Answers

2D 360 degress platformer example needed 0 Answers

How to get rid of jumpy collisions? 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