Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 MattR · May 25, 2012 at 06:30 PM · rigidbodygravitytargetting

Prefab bullet affected by gravity when it shouldnt?

I have a sphere that I can shoot from my character. I have turned off Drag, Angular Drag, Use Gravity, and have set the mass to 1e-07 (Well I tried 0, but thats what the GUI set it to).

Now when I 'fire' the sphere at the target, it moves towards the target, but if the target is some distance away, the path of the projectile decays as though gravity was still affecting it. Ideally I want the sphere to travel in a straight line until its destroy timer kills it (So it moves over the target marker and continues)

So what else do I need to set or tweak?

One thought was that my target is currently at a different height to the firing point, so I am wondering if it is the transform that is inducing an arc, but I dont know the math / functions to stop this happening.

Comment
Add comment · Show 2
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 Owen-Reynolds · May 25, 2012 at 07:02 PM 0
Share

Turning off gravity is generally all you need. How are you moving it?

$$anonymous$$ost people just do a LookAt to the target and set rigidbody.velocity to transform.forward. No Update code. Gives straight-line motion.

avatar image MattR · May 25, 2012 at 07:21 PM 0
Share

I ended up assu$$anonymous$$g it was a nob mistake. I turned off gravityseveral times. Eventually I saved the scene and it seemed to stick.

On with my next task and no doubt problem :)

1 Reply

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

Answer by shadowriffe · May 25, 2012 at 06:56 PM

http://unity3d.com/support/documentation/Components/class-Rigidbody

Enable isKinematic. Will not be affected by gravity.

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 GibTreaty · May 25, 2012 at 07:01 PM 1
Share

is$$anonymous$$inematic will not allow him to use forces on the bullets.

avatar image MattR · May 25, 2012 at 08:39 PM 0
Share

Thanks, at the moment I'm just playing about, so that should be fine, though it would be good to identify the root cause.

avatar image Bunny83 · May 25, 2012 at 08:40 PM 0
Share

@$$anonymous$$attR: Don't post chit-chat as answer. Use comments!

avatar image Bunny83 · May 25, 2012 at 08:44 PM 0
Share

If you disabled Use Gravity there is not gravity applied. You either apply your own force in a wrong way, or it might have collided with something else so the path has changed. If no external forces are applied a Rigidbody moves on a straight line. $$anonymous$$ake sure you don't spawn your bullet inside you character, that will cause a penalty force since you collide with your player.

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

I need help with rigidbody2D/gravity stuff 1 Answer

Rigidbody y velocity is stuck on 0, gravity is not turned off. 2 Answers

Rigidbody gravity between planets 1 Answer

Enable rigidbody gravity,Enable Rigid body gravity 3 Answers

Raycasting ray go through object with gravity enabled 0 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