public bool RayCastGround(BulletWorld pWorld, Vector3 _RayOrigin, float pRayHeight, BulletBody NotMe)
{
DiscreteDynamicsWorld world = (pWorld as BulletWorldXNA).world;
if (world != null)
{
if (NotMe is BulletBodyXNA && NotMe.HasPhysicalBody)
{
CollisionObject AvoidBody = (NotMe as BulletBodyXNA).body;
IndexedVector3 rOrigin = new IndexedVector3(_RayOrigin.X, _RayOrigin.Y, _RayOrigin.Z);
IndexedVector3 rEnd = new IndexedVector3(_RayOrigin.X, _RayOrigin.Y, _RayOrigin.Z - pRayHeight);
using (
ClosestNotMeRayResultCallback rayCallback =
new ClosestNotMeRayResultCallback(rOrigin, rEnd, AvoidBody)
)
{
world.RayTest(ref rOrigin, ref rEnd, rayCallback);
if (rayCallback.HasHit())
{
// 20131224 not used IndexedVector3 hitLocation = rayCallback.m_hitPointWorld;
}
return rayCallback.HasHit();
}
}
}
return false;
}
}