- Home /
Capsule collider bounces where two ground colliders meet
Hi!
I've got a skateboard moving along the x axis, the movement is simply done with the following code in fixed update:
if ((rb.velocity.x < (horizontalSpeed * speedNormalize)) && controllable) {
rb.AddForce (new Vector3 (speedNormalize * horizontalSpeed, 0, 0));
}
The ground beneath is generated with a script (blocks with the width of 30 units are instantiated in front, the ones in the back are removed). The problem is that the board bounces when it crosses the line between the colliders:
The instantiated blocks are aligned perfectly, more screenshots of the colliders and alignment: Imgur (The outer capusle collider is just a trigger used for something else, the one colliding with the ground is the inner one - the size of a wheel)
So the question is: what causes this behaviour? Can it be simply caused by this way of dynamically creating ground? Or is it a weird connection between a capsule collider and box colliders?
EDIT: After struggling with it I found out that dynamic friction and drag coefficient change the behaviour a bit, however playing around with them did not solve the problem completely.
EDIT2: I managed to eliminate part of the problem by replacing capsule colliders with box colliders, it's not the best overall fix, but in my case box colliders seem to work pretty reasonable.
FIX: I found the solution, it's Edit>Project Settings>Physics>Default Contact Offset, decreasing it from default value of 0.01 to 0.0001 fixed the problem.
Answer by Shrimpey · Dec 27, 2017 at 03:14 PM
I found the solution, it's Edit>Project Settings>Physics>Default Contact Offset, decreasing it from default value of 0.01 to 0.0001 fixed the problem.
Your answer
Follow this Question
Related Questions
Set a variable to a collider type. 1 Answer
How did I screw up BoxColliders? 1 Answer
GameObject sometimes collides, but sometimes goes through each other. 0 Answers
Vibration when moving into colliders 1 Answer
Colliders, Mesh or Box? 1 Answer