How to make the capsule fit the player[ the player should stay in the capsule]

    const player = model.meshes[0];
    player.position = new Vector3(0, 0, 0);
    player.scaling.setAll(0.3);
    camera.setTarget(player);

// Create a capsule for the player
const playerCapsule = MeshBuilder.CreateCylinder(‘playerCapsule’, { height: 2, diameter: 1 }, scene);
playerCapsule.physicsImpostor = new PhysicsImpostor(
playerCapsule,
PhysicsImpostor.CylinderImpostor,
{ mass: 1, friction: 0.5, restitution: 0 },
scene
);
playerCapsule.scaling.set(1, 2, 1); // Scaling to make the capsule larger
// Adjust capsule position and visibility
playerCapsule.position = new Vector3(2, 2, 2); // Slightly above ground
playerCapsule.isVisible = true; // Hide in production
playerCapsule.physicsImpostor.physicsBody.angularFactor.set(0, 1, 0);
// Synchronize player mesh (hvgirl.glb) with capsule
scene.onBeforeRenderObservable.add(() => {
player.position.copyFrom(playerCapsule.position);
player.rotationQuaternion.copyFrom(playerCapsule.rotationQuaternion);
});

    const player = model.meshes[0];
    player.position = new Vector3(0, 0, 0);
    player.scaling.setAll(0.3);
    camera.setTarget(player);

// Create a capsule for the player
const playerCapsule = MeshBuilder.CreateCylinder(‘playerCapsule’, { height: 2, diameter: 1 }, scene);
playerCapsule.physicsImpostor = new PhysicsImpostor(
playerCapsule,
PhysicsImpostor.CylinderImpostor,
{ mass: 1, friction: 0.5, restitution: 0 },
scene
);

const capsuleMaterial = new StandardMaterial(‘playerCapsuleMaterial’, scene);
capsuleMaterial.alpha = 0.4; // Set the transparency level (0 for fully transparent, 1 for fully opaque)
capsuleMaterial.diffuseColor = new Color3(3, 3, 1); // Set diffuse color, if needed

playerCapsule.material = capsuleMaterial; // Apply the material to the capsule

playerCapsule.scaling.set(4, 3.5, 4); // Scaling to make the capsule larger
// Adjust capsule position and visibility
playerCapsule.position = new Vector3(0, 0.1, 0); // Slightly above ground
playerCapsule.isVisible = true; // Hide in production
playerCapsule.physicsImpostor.physicsBody.angularFactor.set(0, 1, 0);
// Synchronize player mesh (hvgirl.glb) with capsule
scene.onBeforeRenderObservable.add(() => {
player.position.copyFrom(playerCapsule.position);
playerCapsule.position = player.position.add(new Vector3(0, 3.5, 0)); // Offset the capsule slightly above the player
player.rotationQuaternion.copyFrom(playerCapsule.rotationQuaternion);
});

Found the solution by my self