- Home /
Actual collision happens before the visual collision
Hey there,
Situation: To avoid physics jittering ( from when colliders try to "settle" on top of other colliders ) we have set the "Min penetration for penalty" to 0.05( http://unity3d.com/support/documentation/Components/class-PhysicsManager.html ), which is recommended, but this again leads to us needing larger collision boxes. So when we try to calculate when something hits the ground or other objects, the actual collision will happen before the visual collision...
( If an object is on top of another object( standing still ), these objects will also penetrate each other at a depth of 0.05 units if the collider is the same size as the objects. So it has nothing to do with the objects moving to fast. ;-) )
Question: Are there any way to work around this problem? And is the increasion of the collider the right way to fix the "Min penetration for penalty" increase?
Any solution or hints to what to do would be greatly appreciated. :D
Not sure what you're asking here... But "bigger collision boxes" is usually a bad fix for fast collision issues: http://answers.unity3d.com/answers/170956/view.html
When we set the "$$anonymous$$in penetration for penalty" to 0.05 and have the colliders the same size as the objects, these objects would sink into each other. And the way we have solved this is to increase the colliders of the objects. This again will create the early collision problem.
Are there any better way to solve this then using larger colliders? If not, how should I deal with the "early" collision problem? :)
Yes, raycasting as I pointed in the link. Which, in its turn, points to several similar questions and same answer. $$anonymous$$aybe using that will set your $$anonymous$$d in another direction to solve all other issues that might be deriving from this. If not, come back here and edit the question. It also helps if you can add some working code of the issue.
I appreciate your input here. :) But the thing is; a raycast will collide with the collider, not the visual object, so this would not work. And this has noting to do with objects moving to fast for the physics system to react. What happens is when an object is sitting on another object(not moving at all), and the "$$anonymous$$in penetration for penalty" is set to 0.05 ( http://unity3d.com/support/documentation/Components/class-Physics$$anonymous$$anager.html ) the objects will be penetrating 0.05 units into each other.
At this point there are no actual working code for solving this problem, I have tried to use the OnCollisionStay function, http://pastebin.com/QTPhuAtu , but this isn't giving any satisfactory results.
Hmm... I tried fooling around a lil bit with the $$anonymous$$in penetration for penalty but still couldn't see the jitter... And it's also not good Jessy's similar question is still unanswered. Is that the same issue? What I could notice is that, when you pause the and go frame by frame I can see different behavior on collision when changing its value... So maybe there's something there that can be done. Have you tried fooling with LateUpdate?
Your answer
Follow this Question
Related Questions
Physics Possibilities?: Angles, Penetration, Exceptions 4 Answers
Friction Issue with Multiple Colliders Touching 0 Answers
THIN objects can fall through the ground? (AMAZING SOLUTION) 2 Answers
Wheelcolliders stuck in ground 0 Answers
Why is it so fast to move objects with collider collisions? 1 Answer