Hi,
Perhaps I’m reading the manual wrong but here is my setup.
-I have a projectile that moves 750 meters per second.
-I have box colliders on a character’s bones.
-The projectile has a hit box with a 14 meter long tail (only way it will collide and luckily I know you can’t hit anything behind you)
-projectile is set to continuous.
When my projectile is set to Continuous Dynamic it will pass through the hitbox trigger and hit the static collider behind it.
When my projectile is set to Continuous it will hit the hitbox trigger.
My understanding is that continuous dynamic should be MORE accurate no?
Also my understanding is that when using “Sweep” collision detection I shouldn’t need a huge 14 meter collider. Yet even at a speed of 250 meters per second I need both the large collider on the projectile and the collision detection mode set to continuous to detect a collision.
In this case I can do a raycast but in others I cannot (ships firing over very large distances). My ship combat works but I want to understand WHY I’m getting this behavior so I can avoid future bugs.
Continuous vs. discrete: The collider will constantly check for collisions when it is continuous, and will not check for collisions unless told to. If a collider attached to a rigidbody is discrete and collides with a kinematic (not dynamic) collider, it will become “awake” and will test for collisions for a little bit.
Kinematic vs. Dynamic: Kinematic rigidbodies can’t be pushed around by other rigidbodies, and as I said before, they “wake up” discrete colliders.
Go to the bottom of this page for a complete chart of what combinations of colliders and triggers with rigidbodies set each other off: Unity - Manual: Introduction to collision
I’m sorry Gambit sorry,
Your using “discrete” but I don’t see that in the manual. Are you referring to “dynamic”?
Also I’m getting collisions but not consistently so It’s not the combination of colliders or triggers that is causing the problem. I’m trying to understand why Continuous works consistently when Continuous Dynamic does not as it seamed from reading the manual that Continuous Dynamic should be more not less accurate.
Sorry If you answered the question, but I’m still not clear.
What’s the problem with that? Anybody may ask questions, even professional people. I think it is a good habit to stay quiet if there’s nothing good to say.
Did you really just dig 4 years back into forum posts to make fun of somebody for no good reason? That’s really sad. I’ve been using Unity for over 10 years and I still ask questions all the time.
At least your rudeness has helped me notice that I still need to answer this question!
I honestly don’t use unity physics much at all, so I don’t know how much I can help you. According to the docs, the difference between Continuous and Continuous Dynamic is that Continuous will only detect collisions against other non-rigidbody colliders, but Continuous Dynamic will detect collisions against any colliders, whether they have rigidbodies or not. I’m pretty sure these are expesnive forms of collision detection that can detect collision with objects that have fully passed through each other in a single frame.
@hoesterey Try adding a Rigidbody to the GameObject and setting the mode to Continuous (make sure your bullet is Continuous Dynamic). The Continuous mode is actually not meant to be for moving objects – it’s meant for static objects to prevent fast moving objects from tunnelling through. If you have moving objects, you should always use Continuous Dynamic for them.
I am also experiencing this bug in Unity 2021.3.33f1. I’ve observed fast moving continuous dynamic objects seem to reliably collide with solid static colliders fine, but they can miss static triggers.
Some conditions that may be relevant:
-This bug has been observed within a simulated physics scene where we call myPhysicsScene.Simulate(stepValue) multiple times per Update frame.
-The fast moving objects have sphere colliders so I assume rotation is not relevant, but we have not tested ruling out removing their rotation.
-The fast moving objects have their collider’s physics material set.
-The triggers are never moved and have no rigid body, all static flags are true. Triggers are on layer 18.
Here is a temporary workaround:
Since my objects are spheres I can sphere cast each fixed update step against colliders and invoke OnTrigger logic manually. Just be careful with this approach to handle double calls.