- Home /
Collision between RigidBody and Capsule Collider not producing desired deflection
I'm trying to replicate a ball hitting the woodwork of a goal. The ball is a rigidbody with a sphere collider (0.37 radius) and it is striking a cross bar with a capsule collider (0.1 radius). The ball has a physics material with Bounciness of 0.6.
When the ball collides with the bar, it makes a slight deviation from its path, but not one which is natural looking. I have tried changing the Collision Detection of the RigidBody, but each setting produces the same result. How do I get it to look more natural?!
I have uploaded a video of the issue to youtube. Check it out at http://www.youtube.com/watch?v=Foh-vCJ_m6E
You are using Addforce not transform for your ball right?
I don't know enough about this to give you a definitive answer, not even close.
I just know from what I've experienced using PhysX in Unity I would be extremely surprised and happy if you could get realistic physics without extra work from the user.
Yeah its simply using AddForce. It is colliding and deflecting, if it strikes closer to the centre it looks like it deflects correctly, its the thinner collision that is causing the issue.
Answer by RyanZimmerman87 · Apr 11, 2013 at 10:29 PM
I have never attempted something like this. But my guess would be that you need some kind of somewhat complex calculation beyond Unity's default PhysX.
So maybe obtain the angle and speed that you collided with the object, and use these variables to determine a force to add and a direction of that force?
I could be wrong but I have seen nothing from Unity PhysX in my limited experience that would lead me to believe it is possible to do this without extra calculations on the users end.
I was under the impression that this is what the different settings for Collision Detection were to counteract. I can of course implement some raycasts to deter$$anonymous$$e a definitive collision but I thought this was covered in the current collision implementation.