rapier icon indicating copy to clipboard operation
rapier copied to clipboard

Transforming collision models

Open Yuri6037 opened this issue 4 years ago • 12 comments

What's the best way to scale a collision model such as a compound collision, a triangle mesh collision model, etc.? Ideally this would be good to apply arbitary vector based scaling to any collision model without having to rebuild it. I think Havok has a way to do this considering Source Engine.

Can you apply shearing to the different collision models?

Yuri6037 avatar Oct 13 '21 09:10 Yuri6037

Applying scaling to collider shapes isn’t supported yet. So right now you have to build the scaled object yourself. In the future, we intend to support applying any positive non-uniform scaling to triangle meshes.

sebcrozet avatar Oct 24 '21 14:10 sebcrozet

Applying scaling to collider shapes isn’t supported yet. So right now you have to build the scaled object yourself. In the future, we intend to support applying any positive non-uniform scaling to triangle meshes.

What about other colliders like box, cylinder, capsule, etc?

Yuri6037 avatar Oct 24 '21 18:10 Yuri6037

It wouldn’t be supported for these shapes because these colliders would lose all their nice geometric properties (that makes the collision-detection fast) under general scaling (like shear). I am not aware of any physics engine that supports that (except for uniform scale).

The only other shapes that could support arbitrary scaling are ConvexPolygon, ConvexPolyhedron, and Polyline.

sebcrozet avatar Oct 24 '21 19:10 sebcrozet

It wouldn’t be supported for these shapes because these colliders would lose all their nice geometric properties (that makes the collision-detection fast) under general scaling (like shear). I am not aware of any physics engine that supports that (except for uniform scale).

The only other shapes that could support arbitrary scaling are ConvexPolygon, ConvexPolyhedron, and Polyline.

I was talking about non uniform scaling, not shearing. I think Havok has some support for non uniform scaling, shearing not sure though.

EDIT: I understand that maybe for capsule and cylinder you could only support uniform scaling but for cuboid collision you can certainly handle non uniform scaling.

Yuri6037 avatar Oct 24 '21 20:10 Yuri6037

+1 for scaling collision models. I'm attempting to replace AmmoJS with Rapier.js and setLocalScaling on convex hulls is a feature I use and would like to see available in rapier.

frankieali avatar Sep 23 '22 18:09 frankieali

Any chance of getting uniform scaling soon? It would be nice to be able to scale a rigid bodies without having to rebuild it. Lots of use cases for this.

frankieali avatar Mar 22 '24 03:03 frankieali

@frankieali Have you considered building the scaled shape and assigning it to the existing collider using Collider.setShape?

sebcrozet avatar Mar 23 '24 11:03 sebcrozet