Skip to content

c2TOI returning wrong contact point #357

Description

@ramirez7

I originally brought this up on Discord a while back, but I figured I'd copy it to the issue tracker:


so I'm using the new c2TOI (which returns a c2TOIResult) and the value for p (the contact point) isn't making sense to me. The example I'm doing is testing a stationary AABB and a moving circle.

The only values I'm getting for the p seem to be the AABB's min/max.

λ> c2TOI (c2AABB (C2V 0 0) (C2V 100 100)) (C2V 0 0) (c2Circle (C2V 50 200) 1) (C2V 0 -100) True
C2TOIResult {hit = True, toi = 0.99, n = C2V {x = -0.0, y = 1.0}, p = C2V {x = 100.0, y = 100.0}, iterations = 4}
λ> c2TOI (c2AABB (C2V 0 0) (C2V 100 100)) (C2V 0 0) (c2Circle (C2V 25 -25) 1) (C2V 0 100) True
C2TOIResult {hit = True, toi = 0.24, n = C2V {x = -0.0, y = -1.0}, p = C2V {x = 0.0, y = 0.0}, iterations = 4}

(sorry for the Haskell syntax - I'm testing this in the repl)

In my head, I would expect the first one to collide at (50, 100). And the second, I expect it to collide at (25, 0)


Here's a hand-drawn illustration of expectations vs reality. I marked the p I got in red. And I marked a point e which is what I expected:

image


I've also rigged up a C repro in a MR in my Haskell bindings repository. I did it in the same form as this gist.

hit = 1; toi = 0.990000; n = (-0.000000, 1.000000), p = (100.000000, 100.000000), iterations = 4

image

(Note that I'm using a copy of cute_c2.h in-tree)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions