- Home /
2D platformer landing problem?
Hi there! I'm having a problem with landing in a 2d platformer I'm working on.
The problem is sometimes when the player lands on the ground after falling or jumping they will slightly clip into the ground and then bounce back up. It is very quick, only a few frames, but it is very jarring because the camera is following the player so it jitters really quick when the player clips into the ground and bounces back up.
I have tried to search for a solution to the problem but haven't found one. Somewhere it said that it was a problem with the physics implementation in unity and there is no way to fix it outside of changing the physics update timestep but that comes with a significant performance cost. I find this hard to believe.
I know there has to be a way to solve this problem because I know people have made platformers in unity before without this issue.
Does anyone have any suggestions on how to have an object land on the ground without clipping into it? Please help me. It will be greatly appreciated.
have you tried setting the collision detection on the rigidbody2D to continuous?
You could use a smoother camera that is not shakeing so much. Or maybe uf u are using mesh colliders use box collider. box colliders are a bit quicker
@OrbitGames: Yea I have tried setting the collision detection to continuous but the problem persists.
@Adalino: The camera is smooth. It only shakes at one moment because it is following the player as the player clips into the ground and bounces back out
Answer by PAHeartBeat · Jul 30, 2015 at 11:28 AM
Hi,
I also faced same issue when I am workin 2.5D plarformer game. we are using 3d mesh to create ground and some time gounds mesh collider will skip collision check so its goes little in and then bounce back as you face.
please check your collider once, if you are using mesh collidr or 2D polygon Collider, replace with Box collider. you can also face that issue if your character is came down very fast. if your character come down very fast after jump you need to adjust (value should be differ as per spped, very fequant calculation will effect your actual FPS) fixed time in time manager. Physic calculation done evry fixed time frame not on actual time frame.
The game I'm working on is strictly 2D, not 2.5D. I'm not using any mesh or polygon colliders. I'm using a circle collider on the feet in order to easily go up slopes but I suppose I could try a box collider to see if it solves the problem.
circle collider for the character is perfect cos may be your platform has slop / curves, so circle collider is better option for character so it would smoothly moves on curves, up/down slop.
As you siad your game is pure 2D. so you need to check once fixedDeltaTime in Edit=>Project Settings=>Time $$anonymous$$anager.