dimforge / parry

2D and 3D collision-detection library for Rust.
https://parry.rs
Apache License 2.0
555 stars 96 forks source link

Introduce ScaledTriMesh shape #36

Open Ralith opened 3 years ago

Ralith commented 3 years ago

Allows reuse of collision geometry between scaled objects, e.g. encoded in a GLTF file.

I think this change is more or less complete, albeit untested, but I'd like to discuss some questions before moving forwards:

MOZGIII commented 3 years ago

Can we merge this?

Ralith commented 3 years ago

It should be tested first, and I'd like to see the discussion points addressed. Especially given that the QBVH isn't shared, I'm not sure it's worth the trouble vs. just duplicating geometry as needed.

Jasper-Bekkers commented 1 year ago

Should the transformation be more general? Translation/rotation can be expressed elsewhere, but maybe someone wants to skew? GLTF at least doesn't support anything beyond translation + rotation + nonuniform scaling, but there's not much downside to an arbitrary transform matrix here.

My usecase is exactly this, our data comes from regular gltf files and so we inherit their transforms and need to pass those onto runtime systems like the physics system. Switching to uniforrm scaling wouldn't help us.

Is any of this worth the extra code? Downstream code can always just make another TriMesh with whatever vertices it likes. Collision geometry usually isn't that big, especially for repeated objects. The composite shape abstraction makes the implementation pretty concise, but even so...

We're actually running into this - having to runtime duplicate triangle data just to get a scaled clone of the TriMesh, having this upstreamed / merged would benefit us for sure.

Ralith commented 1 year ago

We're actually running into this - having to runtime duplicate triangle data just to get a scaled clone of the TriMesh

The question is, is doing that duplication causing you any concrete problems?

Jasper-Bekkers commented 1 year ago

We're actually running into this - having to runtime duplicate triangle data just to get a scaled clone of the TriMesh

The question is, is doing that duplication causing you any concrete problems?

Yes. We have transforms changing at runtime, including scale. It's both CPU and memory overhead we want to avoid.

Jasper-Bekkers commented 11 months ago

Any update on this?