Background:
I have a TerrainQuad at (0,0,0) with no rotation (it's on (x,z) plain and
height extends it into y), and I have a Ray for which y is a value above the
highest hill in the TerrainQuad and (x,z) are values computed at runtime, and
its direction is (0,-1,0) (straight down onto the scene). I am colliding the
Ray against the TerrainQuad.
Current Behavior:
If (x==0) or (z==0), collisions are detected against the TerrainQuad correctly
(CollisionResults.size() > 0), and
CollisionResults.getClosestCollision().getGeometry() correctly returns part of
the TerrainQuad, however, getContactPoint() returns coordinate (0,0,0) instead
of (x, contact.y, z).
ex: ray at (0,500,-30) projected in direction (0,-1,0) correctly detects a
collision against the TerrainQuad, but getContactPoint() returns (0,0,0).
Expected Behavior:
getContactPoint() should return the contact point, not some other unrelated
point.
Additional Thoughts:
I'm wondering if this is happening at the edges of the TerrainQuad patches,
jMonkey being smart enough to know that the terrain as a whole was collided
with, but then, in the calculation of the point, it's not inclusive of the
edges so the ray passes exactly between the patches? If this is the case,
perhaps the variable containing the point to return is initialized to (0,0,0),
then just doesn't get changed to the correct point since that point is not
found.
I was fortunate enough in my specific case that my picking ray will always have
direction (0,-1,0), so I can just use (x, getHeight(xz), z) instead, but
obviously not all situations will be so fortunate.
Original issue reported on code.google.com by Loduw...@gmail.com on 11 Dec 2011 at 5:21
Original issue reported on code.google.com by
Loduw...@gmail.com
on 11 Dec 2011 at 5:21