Commit fa42910
committed
fix(ccd): honor filter_contact_pair PhysicsHook during CCD
Closes #754.
The narrow phase already consulted the user's `filter_contact_pair`
hook when deciding whether to compute contacts for a pair. CCD's
`find_first_impact` and `predict_impacts_at_next_positions` did not,
so fast-moving CCD-enabled bodies still got motion-clamped by pairs
the user had filtered out.
This thread `hooks: &dyn PhysicsHooks` through both CCD entry points
and calls the filter at each pair-evaluation site (one in
`find_first_impact`, two in `predict_impacts_at_next_positions` —
the first-sweep loop and the resweep loop). The shared logic lives
in a private `pair_filtered_out_by_hooks` helper in `ccd_solver.rs`
that mirrors narrow-phase semantics exactly.
Signature change: `CCDSolver::find_first_impact` and
`CCDSolver::predict_impacts_at_next_positions` take an extra
`hooks: &dyn PhysicsHooks` argument. `PhysicsPipeline::step` callers
are unaffected; only code calling the CCD solver directly needs to
update.
Regression test added in `pipeline::physics_pipeline::test` that
reproduces the bug: a 200 m/s CCD body rejected from a pair via
`filter_contact_pair` passes through instead of clamping.1 parent 87c8cf7 commit fa42910
3 files changed
Lines changed: 172 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
1 | 15 | | |
2 | 16 | | |
3 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
5 | 8 | | |
6 | 9 | | |
7 | | - | |
| 10 | + | |
8 | 11 | | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
12 | 50 | | |
13 | 51 | | |
14 | 52 | | |
| |||
117 | 155 | | |
118 | 156 | | |
119 | 157 | | |
| 158 | + | |
120 | 159 | | |
121 | 160 | | |
122 | 161 | | |
| |||
199 | 238 | | |
200 | 239 | | |
201 | 240 | | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
202 | 247 | | |
203 | 248 | | |
204 | 249 | | |
| |||
242 | 287 | | |
243 | 288 | | |
244 | 289 | | |
| 290 | + | |
245 | 291 | | |
246 | 292 | | |
247 | 293 | | |
| |||
325 | 371 | | |
326 | 372 | | |
327 | 373 | | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
328 | 380 | | |
329 | 381 | | |
330 | 382 | | |
| |||
442 | 494 | | |
443 | 495 | | |
444 | 496 | | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
445 | 503 | | |
446 | 504 | | |
447 | 505 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
374 | 374 | | |
375 | 375 | | |
376 | 376 | | |
| 377 | + | |
377 | 378 | | |
378 | 379 | | |
379 | 380 | | |
| |||
385 | 386 | | |
386 | 387 | | |
387 | 388 | | |
| 389 | + | |
388 | 390 | | |
389 | 391 | | |
390 | 392 | | |
| |||
638 | 640 | | |
639 | 641 | | |
640 | 642 | | |
| 643 | + | |
641 | 644 | | |
642 | 645 | | |
643 | 646 | | |
| |||
709 | 712 | | |
710 | 713 | | |
711 | 714 | | |
| 715 | + | |
712 | 716 | | |
713 | 717 | | |
714 | 718 | | |
| |||
954 | 958 | | |
955 | 959 | | |
956 | 960 | | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
957 | 1055 | | |
958 | 1056 | | |
959 | 1057 | | |
| |||
0 commit comments