Repository navigation
Commit 97537e4
fix(warp): infinite planes' broad-phase AABB was razor-thin, hiding the ground (#23)
MuJoCo's "infinite plane" convention (geom size[0] == size[1] == 0.0) is
already correctly special-cased as unbounded in ray_plane_distance's actual
intersection test, but update_aabbs_kernel/update_aabbs_batch_kernel used
that literal 0 as the plane's broad-phase AABB half-extent instead. That
makes the plane's bounding box for the BVH almost zero-width, so the BVH
culls nearly every ray before the real intersection test ever runs - the
ground becomes effectively invisible to raycasting while finite geoms (legs,
boxes, etc.) are unaffected, since they don't hit this branch.
Substitute a large-but-finite half-extent (1000m) for the AABB only when a
plane's size is <= 0, leaving the actual intersection math (which already
handles size 0 as infinite) untouched.
Verified with a synthetic scene (floor + sensor at z=1.1m): straight-down
rays now report distance ~1.100001 (previously 0, i.e. no hit) with this
fix.
Co-authored-by: porizou <h.mori@openreach.tech>1 parent 988a219 commit 97537e4
1 file changed
Lines changed: 25 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
45 | 59 | | |
46 | 60 | | |
47 | | - | |
| 61 | + | |
48 | 62 | | |
49 | 63 | | |
50 | 64 | | |
| |||
79 | 93 | | |
80 | 94 | | |
81 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
82 | 105 | | |
83 | 106 | | |
84 | | - | |
| 107 | + | |
85 | 108 | | |
86 | 109 | | |
87 | 110 | | |
| |||
0 commit comments