Hey @Aerion thanks for the kind words. The sliding collisions is actually handled by the physics engine (Physijs, https://chandlerprall.github.io/Physijs/), so the really interesting code is all in there.
To get the physics engine to simulate nice-feeling player movement, I basically attached the camera to a capsule shape (Physijs.CapsuleMesh) and then disabled rotation for that shape:
playerObject.setAngularFactor(new THREE.Vector3( 0, 0, 0 ))
… and then rotated the attached camera, for mouse-look
Here are some of the parameters that I’m using, as far as tuning:
Floor and wall friction: 1.0
Floor and wall restitution: 0.5
Player friction: 1.0
Player restitution: 0.0
Player mass: 3.0
Player shape’s height: 4.5
Player shape’s end cap radius: 1.25
Simulation gravity: (0, -30.0, 0)
And last, I use a central impulse (
playerObject.applyCentralImpulse()) on each frame, to push the player around. The impulse is vector scaled to length 3.0.
Hopefully that helps!