• 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 TheOcelot4000 · Jan 13, 2015 at 07:05 PM · trajectory

Need help With The Tank Bullet trajectory.

what i mean by this is that when i shoot a bullet off a slope/ramp it does not go in the direction of the barrel of the tank. If you have and suggestions pls tell me in the comments below.

Comment
Add comment · Show 3
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 TheOcelot4000 · Jan 13, 2015 at 07:26 PM 0
Share

Um How do i do that.... Im kind of new to unity.

avatar image Noah Dyer · Jan 13, 2015 at 07:39 PM 1
Share

@TheOcelot4000 If you post your code, it will be easier to fix, rather than guess at what you're doing.

avatar image TheOcelot4000 · Jan 13, 2015 at 08:49 PM 0
Share

Ok here is the Code

pragma strict

ar prefabBullet:Rigidbody; var shootForce:float; var shootPosition:Transform;

function Update() { if(Input.GetButtonDown("Jump")) { var instanceBullet = Instantiate(prefabBullet, transform.position, shootPosition.rotation); instanceBullet.rigidbody.AddForce(shootPosition.right * shootForce);

 //    var instanceBullet = Instantiate(prefabBullet, transform.position, Quaternion.identity);
  //   instanceBullet.rigidbody.AddForce(shootPosition.forward * shootForce);
     
     //var shot : Rigidbody = Instantiate(projectile, shotPos.position, shotPos.rotation);
     //shot.AddForce(shotPos.forward * shotForce);
 }
 }

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by skylem · Jan 13, 2015 at 08:54 PM

Drag the object your spawning the bullet from, beneath the barrel of the tank GameObject gameObjects within others Gain there position/rotation from the gameObject they are placed within.

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 TheOcelot4000 · Jan 13, 2015 at 09:00 PM 0
Share

....... i have no idea what your talking about xD.. as you could tell i am Very new to unity.

avatar image TheOcelot4000 · Jan 14, 2015 at 02:10 AM 0
Share

Ok thanks for Yalls help i found out what the problem was

avatar image TheOcelot4000 · Jan 14, 2015 at 02:58 AM 0
Share

Well what i did to fix it was i changed the Scale of the Shooting thing to 0.01 on the X Y Z Axis And then for the bullet i used i set the Colliders Radius to 1.126221 and the Hight to le-05 And the Bullets scale is X1,Y0.5,Z0.3 But this is what i set them to be so i does not Hit the tank hull's Collider.

avatar image
0

Answer by bodec · Jan 13, 2015 at 07:09 PM

you need to parent the spawn point of your bullet to the turret itself then call the rotation of the spawn. it sounds like you are making a call to an item that isn't rotating with your turret

Comment
Add comment · 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

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Setting limits to my trajectory 2 Answers

trajectory of ball 0 Answers

Bezier curve that update in real time. 1 Answer

Trajectory Prediction with Particle Systems 1 Answer

Calculate a trajectory in all possible directions (2D). 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