parry icon indicating copy to clipboard operation
parry copied to clipboard

Use cuboid_cuboid contact implementation.

Open ThierryBerger opened this issue 9 months ago • 0 comments

cuboid_cuboid contact implementation is currently commented out, this PR investigates why and will attempt to bring it back.

** :warning: Currently in draft because current implementation is incorrect.**

step 1: add test

Currently, contact fall back to using the more generic "as_support_shape" implementation. Let's compare both results and see if any is incorrect.

a simple test (see c2686ceded77722235b0fc2be54f766ae1bd708f) reveal differences betweens the 2 implementations:

test log

[crates/parry3d-f64/../../src/query/contact/contact_cuboid_cuboid.rs:153:9] result_support = Some(
    Contact {
        point1: [
            1.0,
            0.25,
            0.25,
        ],
        point2: [
            -1.0,
            -0.25,
            -0.25,
        ],
        normal1: [
            [
                1.0,
                0.0,
                -0.0,
            ],
        ],
        normal2: [
            [
                -1.0,
                0.0,
                0.0,
            ],
        ],
        dist: -1.5,
    },
)
[crates/parry3d-f64/../../src/query/contact/contact_cuboid_cuboid.rs:154:9] result_cuboid = Some(
    Contact {
        point1: [
            -0.5,
            1.0,
            1.0,
        ],
        point2: [
            -1.0,
            1.0,
            1.0,
        ],
        normal1: [
            [
                0.0,
                0.7071067811865475,
                0.7071067811865475,
            ],
        ],
        normal2: [
            [
                0.0,
                -0.7071067811865475,
                -0.7071067811865475,
            ],
        ],
        dist: 0.7071067811865476,
    },
}

on cuboid_cuboid, dist being positive suggests there is no intersection, which is wrong here.

ThierryBerger avatar Mar 03 '25 10:03 ThierryBerger