- Home /
CapsuleCast consistent error in size
Recently we ran into a problem using capsule cast that we tracked down to what we think might be an error in unity. Consistently our capsule casts would only return true when the collider was well within bounds. The error was pinpointed to be 0.1 in size, no matter the size of the check.
In the image below a capsule is cast from the red circle on the right to the red circle in the middle, the radius of the cast is represented by the yellow circle, which is exactly 0.1 greater in radius than the red ones. The green circle was then moved towards the cast until it finally collided, 0.1 distance within the bounds that it should have collided with.
We've been able to easily replicate it, so I hope there is something obvious that we are doing wrong.
P.S. the checks were done with a huge height, and on the same y coordinate, to make sure that it wouldn't be an issue.
[edit] P.P.S. if anyone would be interested, a project displaying the discrepancy can be provided.
[edit2] Important note, the green capsule is a character collider. It appears to work fine enough for normal colliders. I reduced skin width to 0.0001, but it had no effect.
Answer by Matt-Downey · Jun 16, 2012 at 11:49 PM
Go to the tab "edit"-->"project settings"-->"physics" and look at the "min penetration for penalty" variable. If that variable is 0.05, then that is precisely the behavior the Unity3d dev team intended. The 0.05 is multiplied by 2 to yield 0.1 because there are two objects colliding and each can travel 0.05m without any penalty.
With any luck I figured it'd help someone down the line.
The "CapsuleCast" tag doesn't have all too many questions associated with it, and I can't find the answer I'm looking for myself, although it might just be a driver issue. (SphereCast works perfectly and capsuleCast doesn't register.)
Your answer
Follow this Question
Related Questions
Why does CapsuleCast appear in the wrong place? 0 Answers
Invalid AABB Error on collision :( 1 Answer
The CapsuleCast is broken. 0 Answers