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
5
Question by BinaryCore 1 · Mar 15, 2011 at 07:21 PM · collisionphysicsdynamiccontinuous

Issues with Continuous Dynamic collision.

I'm rolling a fast moving ball that has a spherical collider set to Continous Dynamic collision detection for most precise collision detection. The objects it's colliding with are capsule colliders set to Continous detection.

Now, this is the recommended configuration for detecting collision for fast moving objects in Unity. However, I'm 'occasionally' seeing the ball still sneak through the colliders at indeterminate times.

From my understanding of Continous Dynamic collision, this shouldn't be possible (unless you screw up such as scaling the parent of the rigid body or directly set translation on the rigidbody while it's moving - neither of which I'm doing.)

So I expect this to be working. Any ideas how or why Continous Dynamic could still occasionally skip collisions? I don't want to have to resort to using ray casting to ensure collision if I don't have to.

I've already searched the forum and haven't seen mention of this exact issue, so I'm trying to figure out where I must be going wrong on this...

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 cregox · Mar 29, 2011 at 08:11 PM 0
Share

related: http://answers.unity3d.com/questions/49252/cheapest-way-to-catch-collisions-on-very-fast-moving-objects/49259#49259

3 Replies

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

Answer by Andy Korth · Mar 24, 2011 at 08:50 PM

Your ball passes through the capsule colliders because it's velocity is so high that the distance it moves from one frame to another will bring it from one side of the capsule to the other without ever having overlapped the collider.

By reducing the timestep, more intermediate positions are calculated, and the collision is more likely to be found. That's what you've done by adjusting your timestep.

Swept collisions (also called continuous collision detection) work by determining the path of the objects as they move between frames, to determine if fast moving object's paths have collided between frames. So it should solve your problem. However, in simple replication projects, I've noticed issues with the continuous collision detection. I've filed bug 389071 with Unity, but I haven't heard back about it.

Comment
Add comment · Show 5 · 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 BinaryCore 1 · Mar 28, 2011 at 04:18 AM 2
Share

Yep, I'm aware of how all the collision does work, but the issue I was having is that even though I had Continuous Dynamic turned on for the moving object, and Continuous set for the objects collided with, collision was still periodically failing detection. This was not supposed to be possible with Continous Dynamic turned on, yet that's what is happening.

avatar image Andy Korth · Mar 29, 2011 at 05:48 PM 2
Share

Yeah, so I'm glad it's not just me who thinks it's buggy.

avatar image james 6 · Apr 29, 2011 at 06:37 PM 1
Share

i have the same problem

avatar image RichPixel · May 03, 2011 at 04:08 PM 0
Share

I'm seeing the same thing - a moving ball passing through a fast-moving capsule. The capsule just rotates though.. like a pinball flipper. I've tried all manner of 'continuous' settings on the bodies to no avail. Will try the time step solution.

avatar image bboysil · Jun 04, 2013 at 09:42 PM 1
Share

I just tried continuous dynamic on my rigidbodies. One of them is a kinematic object is moved with $$anonymous$$ovePosition in FixedUpdate.. but it lets objects pass through at high speeds. Tried this in Unity 4.1.3

avatar image
2
Best Answer

Answer by efge · Mar 15, 2011 at 07:29 PM

You could try to solve this by adjusting the settings in the Physics Manager and the Fixed Timestep in the Time Manager.

Comment
Add comment · Show 2 · 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 BinaryCore 1 · Mar 15, 2011 at 07:35 PM 0
Share

Good point. I'll give that a try and see how it goes.

avatar image BinaryCore 1 · Mar 15, 2011 at 07:54 PM 2
Share

Decreasing the time step definitely helps. I haven't seen it get through yet since I changed it. But I'm having to set fixed timestep to less than 0.02 which was already 50 times a second. The worry for me now is that this is on iPhone, and that may just be way too heavy on the cpu. Hrm.

avatar image
9

Answer by Bezzy · Sep 05, 2012 at 01:34 PM

I've managed to come up with pretty rock solid movements for high speed bullets, testing against each other (well, actually, each bullet has a "bullet detector" trigger collider on it, in a different layer which only listens for the bullet collider's layer (non triggers). Bullets don't directly interact with one another - only via their detectors.

I made the bullet a capsule, pointing along its Z (as that's the relative axis it always travels along in this case).

I then calculate how far the bullet moves during one physics step by multiplying the muzzle velocity by Time.fixedDeltaTime

I then set the height of the capsule to that displacement step size (but also take into account the radius of the capsule affecting height).

Thus, even at very high speeds, there will be a frame where the bullet collider overlaps the bullet detector, and the bullets will not pass through one another.

Very good performance, and works well with object pooling.

Haven't tried it with varying bullet speed (i.e. varying collider height), but I've little reason to think it'd stop working, so long as the height changes are made in a FixedUpdate step.

Also, this is kind of the equivalent of a collider sweep, but I've found that to be highly susceptible to floating point inaccuracies -not insurmountable, but a real rathole)

Comment
Add comment · Show 2 · 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 goodhustle · Feb 23, 2013 at 07:02 AM 0
Share

This is an awesome comment, you just solved my continuous dynamic bullet problems! Thank you!

avatar image grojguy · Apr 23, 2013 at 06:47 PM 0
Share

I'm definitely up-voting that comment. Great idea Bezzy!!

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Continuous collision detection - unnatural behaviour 0 Answers

How to perform grasp action on a cloth? 3 Answers

Two Moving Sphere Colliders with Continuous Dynamic miss each other 2 Answers

Rigid body Continuous and ContinuousDynamic seem to do nothing 1 Answer

FPS Tutorial: Why do my grenades go through the walls? 3 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