Hello guys, just wanted to know whats new about this feature on following release.
Is it possible to expose some setter for the capsule height ?
Lets suppose I need to make my character crouch I would like to set it to half height for instance.
Thanks !!
Leandro.
The PhysicsCharacterController exposes a setter for the shape, so you can just create whatever PhysicsShape you like and assign it:
let characterController = new PhysicsCharacterController(...)
let standingShape = characterController.shape;
let crouchingShape = new PhysicsCapsuleShape(...);
if (wantSwitchToCrouching)
characterController.shape = crouchingShape;
if (wantSwitchToStanding)
characterController.shape = standingShape;
By default, the character’s shape is centered around the character position. When generating the capsule for crouching, you probably want to keep the bottom capsule point the same, and just lower the top point. That’ll keep the character nicely grounded when transitioning.
Is it the same for Lite?
In lite, capsule shape can be edited with this function : Babylon-Lite/packages/babylon-lite/src/physics/character-controller.ts at 2d170d72af2916cb109d31d59d7440edbce03964 · BabylonJS/Babylon-Lite · GitHub