[ODE] Heightfield / Collision.
Fabian Herb
commander at herb-clan.de
Tue Feb 18 12:05:02 2003
Hello,
I think there are two issues why one should do (or at least I do) edge testing.
Imagine this not-very-smooth terrain (viewed from side):
/--\
| | sphere
\__/
/\<-edge of two triangles
/ \
/ \<-triangle face
/ \
/terrain \
One thing is contact normals:
In this case we had just two possible normals: one to the upper
right, the other to the upper left. But you would the sphere expect
to bounce upwards. This is the sphere-edge collision.
The other thing possibly only applies to my own heightfield collider:
To detect sphere-face collisions, I take the face normal, and subract
it from the sphere position (this is actually a plane-point distance
check). Then I check whether this point is inside the triangle when
viewed from top (simple 2d distance check from sides). In the case
shown above, this point would be outside both triangles, causing the
sphere to inter-penetrate the terrain at the edge.
If you use a different method for face-testing, and only have very
smooth terrains, perhaps you don't notice the wrong (or inaccurate)
collision normals.
Regards
Fabian Herb
>Haven't done collision before, and I'm trying to reason sphere-try collision
>to myself. I'm just wondering why one would need to do tri-edge tests with
>tri-edge normals (on top of tri-face tests) - if the mesh is a closed hull,
>don't the connected triangle face tests take care of everything?
>
>If that's right, then for terrain colliding we don't need to do edge
>testing, or am I missing something?
>--
>gl