Box Collider Briefly Clipping Through Ground After Fall
Hello! I've been struggling to find a concise way to word this issue which has led to a lack of results from my own research, so I will ask here. Thank you for your time!
In a small game I'm making for a class project, the player's gameObject will very briefly clip through the ground after falling from a certain height and I was wondering how to make the collision smoother to prevent this. It's not clipping through entirely, just sinking in about 0.1 units into the collider before snapping back to where it should be. Some notes about the current set up;
The basic movement code is in FixedUpdate().
The jump function is in Update() and looks like this;
Interpolate is set to Interpolate.
Collision Detection is set to Continuous Dynamic.
Decreasing Mass hasn't helped.
Adding drag hasn't helped.
Lowering gravity hasn't helped.
The collider is a 1x1x1 Box Collider.
The collider and rigidbody are on an empty object which is the parent of a basic sphere object which doesn't have anything but the basic renderer on it.
The player object's World Center of Mass on the ground is 0.5. After a fall it clips down to around 0.4 before being pushed back up to 0.5. It's a small discrepancy but I can see the sphere clip into the ground for a moment.
The clipping happens inconsistently but happens more frequently when falling from a greater height.
Physics engines are not always perfect, this kind of situation is where you should accept your fate or try hacky wacky solutions. A solution I would suggest is to raycasting to the ground for an "enough" length and dealing with the fall yourself when it detects a ground object. If it would feel too "static" for you, I would try falling and grounding animations too. Wouldn't work by itself but with together, they can look cool.
Your answer
Follow this Question
Related Questions
Ball Physics? 0 Answers
Why is my Character's BoxCollider getting stuck in between two wall BoxColliders? 0 Answers
Ball won't stop bouncing 1 Answer