i think i've got a bug or rounding issue on terrain. heres the gist of my code.
Code: Select all
public static RayResult terrainray(Ray r, RayCastableContainerWithoutMargins terrain)
{
RayResult result = RayResult.Zero;
terrain.rayCast(r.Position, r.Direction, 10000,
out result.hitEntity, out result.CollisionPos,
out result.normal, out result.time);
//CONVERT NORMAL TO DECAL MATRIX
result.CollisionMatrix = Matrix.Invert(Matrix.CreateLookAt(
Vector3.Zero, result.normal,
new Vector3(1,0.9f,1)))
* Matrix.CreateTranslation(result.CollisionPos);
return result;
}
It just returns a non-collision
result.CollisionPos = {X:-3.402823E+38 Y:-3.402823E+38 Z:-3.402823E+38}
result.time = -9999.0
any ideas?