How do I scale a rigidbody with code?

How do I scale a rigidbody down. I want to scale it down when i press S but i don’t know how to do it with code. see this:

if(this.app.keyboard.isPressed(pc.KEY_S){ //code for scaling down a rigidbody object }

Hi @jus.co_ding_me_23,

You can’t really scale a rigidbody since as soon as it’s created and added in the physics simulation the shape can’t change.

What you can do is update your collision component to get a new shape and then re-add the body in the sim.

Check this thread, it contains an example on how to change the height of the player controller (a rigidbody) to enable/disable crouching:

ok i will try