Manipulating imposter size (radius). Is it possible?

Hi all.

I’m trying to give my mesh a larger physics body, as the one that is dealt is too small. Is this possible? I’ve tried to drill down into the lower level of CannonJS, but I’m having zero luck (see below for snippit)

var imposter = new BABYLON.PhysicsImpostor(mesh, BABYLON.PhysicsImpostor.SphereImpostor, { mass: 2, friction: 1, restitution: 0 }, this);
var body:CANNON.Body = imposter.physicsBody as CANNON.Body;
var sphere = body.shapes[0] as CANNON.Sphere;
sphere.radius = 200;
sphere.boundingSphereRadius = 200;

Hi Tomph! I have no solutions, yet… but I found a playground to test-upon:

https://www.babylonjs-playground.com/#IFN77Q#56

I did two basic tests in lines 70-80 area. Remarks are there.

Nothing discovered and learned. I THOUGHT line 73 would work just fine on its own, but no joy. Setting scaling on mesh after impostor added… seems to kill the physics. Not sure why.

Anyway, we have a playground to play-with. :slight_smile: Stay tuned for more comments/tests.

[comments removed here]

1 Like

@trevordev is our physic expert

1 Like

https://www.babylonjs-playground.com/#IFN77Q#57

???

Larger physic body?

1 Like

Yeah, I did go down that path while testing @Rah I just hoped it wasn’t necessary to add compound meshes in order to achieve what I wanted… Every other physics engine I’ve used before treats the collider/imposter independently from it’s parent (mesh). Seems crazy to me!

1 Like

Does this post help? Scaling physics bodies after creation · Issue #270 · schteppe/cannon.js · GitHub

Here is a playground that seems to manipulate the impostor and mesh independently:
https://playground.babylonjs.com/#9INS81#3

1 Like

thanks @trevordev that does seem to answer my question!

Thanks to everyone else for chipping in. These forums are great!