I procedurally generate a map, this map then gets the correct mesh added at the end doing the following:
mesh.Clear();
mesh.vertices = vertices;
mesh.triangles = triangles;
mesh.colors = colors;
Where the vertices, triangles, and colors are assigned during generation
The mesh looks as follows in the finished map.
Now whenever I walk I keep falling through the floor, this happens both when walking, but also after not holding any input and just falling. My walking code is this:
private void FixedUpdate()
{
// Calculate the movement direction based on the camera's orientation
Vector3 forward = cameraTransform.forward;
Vector3 right = cameraTransform.right;
forward.y = 0f;
right.y = 0f;
forward.Normalize();
right.Normalize();
// Calculate the new position using the movement direction
Vector3 newPosition = transform.position + (forward * moveDelta.y) + (right * moveDelta.x);
rb.MovePosition(newPosition);
}
public void OnMove(InputAction.CallbackContext context)
{
moveDelta = context.ReadValue<Vector2>();
}```
The ground generator has a mesh collider, and I tried it with, and without rigidbody:
The player is a simple capsule collider with a Rigidbody attached:
Collision detection is set to continuous.
https://gyazo.com/70b3ecbd719490c20c068d473b8bee1e