How to create physics character controller in theory?

Let’s say we are creating simple physics character controller that moves using WASD keys.

First problem that I faced it’s a movement. How to properly move physics CC?

  1. Using applyForce/applyImpulse - I don’t like it because of bad feedback from such controller. Character slowly increasing its speed but then it flies as fast as crazy. Don’t undestand how to solve it. Clamping? Ok, but how?
  2. setLinearVelocity. It’s more usual technique for me. But look I can’t use frame dt-time here. If I set setLinearVelocity just for 1 frame:
playerImpostor.setAngularVelocity( new Vector3( 5, 0, 0 ) );

it gives me following x values in the render():

playerPosX: 0
playerPosX: 0.1411302409033075
playerPosX: 0.2614556048584587
playerPosX: 0.35569196846402606
playerPosX: 0.42343760794770186
playerPosX: 0.46704296055634603
playerPosX: 0.485196052615534

so it looks physics engine do some lerp-work by its own. So how can we control lerping here? IDK.

Guys, can you please give some advices how do you make physics controllers?

Created my first try “CC using impulses of CannonJS”: Playground
I have no idea how to implement smooth increasing and decreasing of speed so now it immedialety goes fast.

cc @Cedric
I know there is ssatguru/BabylonJS-CharacterController: A CharacterController for BabylonJS (, but it doesn’t use physics

Yes, as @carolhmj said, I would not use a physics engine for gameplay specific character controler.
I would use it only for collision detection.