public void RayHeightmapDDATest() { for (int i = 0; i < RAY_COUNT; i++) { float dist; RayHeightmap.CollisionTest(randomRays[i], heightmap, 256, 256, 256.0f, out dist); } }
public bool FullSceneCollisionTest(bool includeTerrain, Ray ray, ISceneEntity castingObj, out ISceneEntity collisionObj, out float dist) { ISceneEntity minCollider = null; float minDist = Single.MaxValue; // Test against the AABB of every entity in the scene (can be slow!) m_scene.ForEachEntity( delegate(ISceneEntity entity) { if (entity == castingObj) { return; } float thisDist; if (entity is IPhysical && EntityCollisionTest(ray, (IPhysical)entity, out thisDist) && thisDist < minDist) { minDist = thisDist; minCollider = entity; } } ); collisionObj = minCollider; dist = minDist; if (includeTerrain) { // Test against the terrain float terrainDist; if (RayHeightmap.CollisionTest(ray, m_terrain.GetHeightmap(), 256, 256, 256.0f, out terrainDist) && terrainDist < dist) { dist = terrainDist; collisionObj = null; return(true); } } return(collisionObj != null); }