# Problems with gravity and box colliders in Unity 3D

I have a game character that can jump or roll in order to avoid obstacles. He is able to roll while on the ground and he can also roll while he is in the air after jumping. Everything was working fine when I made him roll. I want to make it so that when he rolls while he's in the air after jumping, he would fall at a faster pace than if he was just falling normally. So I did this in my c# script:

IEnumerator IncGravAcc()
{
Physics.gravity = new Vector3(0, -50f, 0);
yield return new WaitForSeconds(2f);
Physics.gravity = new Vector3(0, -9.8f, 0);
}


I call this coroutine in the function that runs when the down arrow is clicked. Everything is working fine. When he rolls while in the air, he falls at a faster than normal rate. However he doesn't land properly and he just falls right through the platform like it's not even there. Here's a video to show what I mean: https://youtu.be/sirc4L3MnqM

I have a box collider, not set to isTrigger, on the player (you can see it, the green box, right underneath him in the video) and the player's also a rigidbody. The platforms don't have rigidbodies on them but they do have box colliders set to trigger. You can see the platform's box collider in the relation to player's box collider in the picture provided (the platform's box collider is the larger one of course)

How do I get it so that the character doesn't fall through? Please let me know if there's anything else you need to know about the project. Thank you for helping me!

• I notice your player collision box is quite thin. That will make it easy for it to "miss" a collision with the ground if high gravity pulls it more than halfway through the ground's collider. Can you show us any other movement code relating to this character? You may also want to consider adding your extra gravity via a force that acts only on the player in FixedUpdate, rather than changing the whole world's gravity, which can cause unexpected changes in motion elsewhere in your scene. Jul 12 '20 at 11:45
• @DMGregory I just needed to change my Collision Detection to Continuous Dynamic. But thank you for the advice! Jul 12 '20 at 21:54