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 Mr-Mouse · Nov 27, 2015 at 11:17 AM · rotationassetturrettrajectory

How do I choose the Rotation of an Auto Aim Turret using ballistic trajectory and the muzzle as starting point?

I'm currently working on a school project and I want to shoot a projectile from a auto-aiming spherical turret with a muzzle at a target. I already got the right formulas for the trajectory from the center of the turret to the target and it's working fine so far. The Turret's (and therefore the muzzle's) rotation is set to match the initial velocity of the projectile.

But it still looks wrong, because the projectile is not released from the muzzle. Instead it comes out from under the barrel and of course it gets worse when the trajectory is higher.

What I want to do is set the muzzle as the origin of the projectile trajectory, so that the rotation of the turret/muzzle aligns with the initial velocity of the projectile. The Rotation should not be constrained in any way and the speed of the bullet should be fixed. I don't use air resistance yet, so acceleration and deceleration can be ignored.

Sorry for the beautiful Paint image:

alt text

So how can I get the right turret rotation and therefore the muzzle position? Has anyone encountered this problem? Can anyone help me please?

turret-problem.png (19.8 kB)
Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by suark · Nov 27, 2015 at 03:11 PM

You need to make the bullet child of the muzzle. This way it will move together.

Comment
Add comment · Show 1 · 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 Mr-Mouse · Nov 28, 2015 at 10:58 PM 0
Share

So my Bullet now gets instantiated at the position and rotation of an empty object that is a child of the muzzle which again is a child of the turret. Therefore it flies out of the tip. Thanks!!

But the rest still does not work the way I want it to...

avatar image
1

Answer by robusto · Nov 28, 2015 at 02:17 AM

Don't use the center of the turret as the starting point, use the position of the muzzle's tip or end of the barrel's position (where the projectile comes out). The starting trajectory of the projectile should be the same trajectory of the barrel so when the projectile comes out, it is straight out of the barrel and will fall. This should make it look realistic.

Comment
Add comment · Show 1 · 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 Mr-Mouse · Nov 28, 2015 at 11:20 PM 0
Share

That is working fine now, thanks! But the actual problem still remains. Let me explain my approach. 1. A target triggers the collider of the turret. 2. The turret rotates around the y-axis until it faces the targets postion. 3. The trajectory gets calculated and the turret (or maybe only the barrel) rotates around its x-axis until it points at the right angle. 4. The turret fires.

$$anonymous$$y problem lies in point 3. How do I get the right angle with the given target position, gravity at 9.81Nm and predefined bulletspeed?

Or am I just complicating things here and there is an easier way to both hit the target and get a accurate barrel alignment?

$$anonymous$$aybe a friend of $$anonymous$$e who studies automotive engineering can calculate this. I will keep you all informed and hopefully we can solve this issue!!!

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

6 People are following this question.

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

Related Questions

Submitting package to asset store that requires another asset to work 1 Answer

Constraining turret rotation in local space 1 Answer

Rotate on Z axis 2 Answers

How to check if a trajectory is blocked? 1 Answer

Locking on target with angle (mostly working) 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