public bool Raycast(Ray ray, out OrientedBoxRayHit boxRayHit) { boxRayHit = null; float t; if (Raycast(ray, out t)) { boxRayHit = new OrientedBoxRayHit(ray, t, this); return(true); } return(false); }
public GameObjectRayHit(Ray ray, GameObject hitObject, OrientedBoxRayHit objectBoxHit, MeshRayHit objectMeshHit, TerrainRayHit objectTerrainHit, SpriteRayHit objectSpriteHit) { _ray = ray; _hitObject = hitObject; // Only one kind of entity can be registered as a hit, so we will take the first // non-null hit instance using the following priority: terrain, mesh, sprite, box. if (objectTerrainHit != null) { _objectTerrainHit = objectTerrainHit; _objectBoxHit = null; _objectMeshHit = null; _objectSpriteHit = null; } else if (objectMeshHit != null) { _objectTerrainHit = null; _objectBoxHit = null; _objectMeshHit = objectMeshHit; _objectSpriteHit = null; } else if (objectSpriteHit != null) { _objectTerrainHit = null; _objectBoxHit = null; _objectMeshHit = null; _objectSpriteHit = objectSpriteHit; } if (objectBoxHit != null) { _objectTerrainHit = null; _objectBoxHit = objectBoxHit; _objectMeshHit = null; _objectSpriteHit = null; } }