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 Doneyes · Sep 08, 2013 at 03:00 AM · rigidbodycolliderbulletfast

Bullets going too fast and passing through colliders

My bullets are set to go pretty fast and because of this, they don't always hit the colliders on the enemy. The giant cube wall behind is very thick so the bullet usually ends up hitting that. How can I get it to register the collider and not pass through it because of the high speeds? I set its rigidbody to extrapolate and I don't really notice a difference.

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 RyanZimmerman87 · Sep 08, 2013 at 03:26 AM 2
Share

You could either make the collider bigger, the bullet slower, lower the FixedUpdate() timestep speed, or detect the hit with a Raycast rather than the bullet itself.

avatar image BlAcK_BlAcKiTo · Sep 07, 2017 at 05:48 PM 0
Share

Changing Collision Detection of RigidBody from Discrete to Continuous solved my exact same problem!

2 Replies

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

Answer by Doneyes · Sep 08, 2013 at 04:21 AM

I ended up making the bullet longer in the direction it was traveling and now it works like a charm. Thanks

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 Aggrojag · Jan 26, 2016 at 09:39 PM 0
Share

Also, make sure you are editing the position of the bullet through the rigidbody and not the transform component. Editing of position through transform seems to cause a lot of problems if you're expecting collisions.

avatar image
0

Answer by Tanoshimi2000 · Jan 26, 2016 at 08:13 PM

For anyone looking at this question, I think the established system for handling this problem is to perform your own collision testing by doing a raycast of either where the bullet is to where it's going to be in the next frame, or where the bullet is, to where it was in the previous frame. In either case, if there's an object detected by that raycast, the bullet would (or would have) hit that object.

I prefer the first version, testing where it will go, because that's going to let you know not just what you (are going to) hit, but where you hit it. For example, I have a helicopter made of many smaller parts. Using this method a fast moving projectile will not just hit the helicopter, but hit the 3rd section of the tail rotar. I can then give that piece it's own rigidbody and collider, then add explosive force to it, and make "debris" fall off the helicopter when it's hit.

Just a suggestion for those who come across this question.

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 SterlingSoftworks · Jan 26, 2016 at 09:11 PM 2
Share

There's also changing the Rigibody's Collision Detection from "Discrete" to "Continuous"

Discrete checks if colliders are touching is x frame then yay we collided! If Collider is INSIDE the other collider this is seen as no we didn't collide, thus where this issue arises.

Continous does exactly what you've said with the raycast checking. You just don't have to do the code ;)

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

20 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

Related Questions

Adding force to a bullet as it hits object? 2 Answers

Rigidbody - bullets becomes bullethole image 0 Answers

Excluding some physics collisions 3 Answers

Avoid overlapping of random spawned prefab 3 Answers

Rigidbody behaves differently when I add a collider 5 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