I used collision detection and gravity, but gravity doesn’t seem to work
Collisions are not physics.
You can use gravity in collisions but only for camera: Camera Collisions | Babylon.js Documentation (babylonjs.com)
If you want to apply gravity, you can simply call something like that:
character.moveWithCollisions( m.add(new BABYLON.Vector3(0, vsp, 0)).add(scene.gravity) )