Physical body dont rotate with its mesh

Hey all, I’m playing a bit with the new Physics Engine, but I just realise that when I rotate a Mesh, its physical body don’t follow the mesh just like this:

I’m not fully sure if thats expected or a bug actually but I wanted to open it just in case.

Thats the playground with the issue: Babylon.js Playground

1 Like

checking! :slight_smile:

1 Like

You will need to pass the rotation when initializing the physics body and shape:

Physical body notting rotating with Mesh | Babylon.js Playground (babylonjs.com)

I will wait for @Cedric to comment whether or not this can happen automatically

2 Likes

Interesting, it worked!

Still wondering how it should be done with something moving, but seems like the property rotation isnt supported yet on PhysicsAggregateParameters interface, I’m getting a error that says

Argument of type ‘{ mass: number; rotation: Nullable; }’ is not assignable to parameter of type ‘PhysicsAggregateParameters’.
Object literal may only specify known properties, and ‘rotation’ does not exist in type ‘PhysicsAggregateParameters’

Hey thanks for bringing this to our attention! There was an error with the way the aggregate was calculating the size, so that was fixed, and we also added the missing rotation as an aggregate parameter :slight_smile: Physics: Fix aggregate size calculation and allow passing box rotatio… by carolhmj · Pull Request #13778 · BabylonJS/Babylon.js (github.com)

5 Likes