Lately I have tried to implement naive meshing, which is an algorithm that produces terrain similar to minecraft (cubes).
When the player starts jumping around the terrain, there is a chance it might get stuck in the terrain between a floor and a wall.
The entire mesh is a single meshCollider, and the player is a regular Capsule object with a capsule collider.
Does anyone know how this might be possible? Is there a chance there is a gap in the mesh collider, or is it something with the regular capsule collider that results in this issue?
you’re moving the player so much he fully penetrates a collider, making it impossible for the physics to resolve. You might try continuous collision checking instead of discrete (setting on Rigidbody)
you’re moving the player incorrectly: With Physics (or Physics2D), never manipulate the Transform directly. If you manipulate the Transform directly, you are bypassing the physics system and you can reasonably expect glitching and missed collisions and other physics mayhem.
Always use the .MovePosition() and .MoveRotation() methods on the Rigidbody (or Rigidbody2D) instance in order to move or rotate things. Doing this keeps the physics system informed about what is going on.
changing the collision detection on the rigidbody on the player model from discrete to any other setting did not solve the issue.
Currently, while jumping, the player gets moved with rigidbody.AddForce(). when moving, the player gets moved with gameObject,transform.Translate(). When i change the movement to rigidbody.MovePosition(), the problem still occurs.