private void CheckShipCollision(Ship ship) { var intersect = BoundingSphere.Intersects(ship.BoundingSphere); // Check for bounding sphere intersection first, in order // to optimize performance.. if (!intersect) return; // If sphere intersects, than do a more accurate collision check (per-triangle). if (ship.HasAtLeastOneTriangleIntersectsBoundingSphere(BoundingSphere)) ship.Destroy(); }
private void InitializeShip() { _ship = new Ship(this, "models/ships/feisar/FeisarShip", "models/SkyGlobeTexture", _shipInfo); _ship.SetMaterial(0, new Material { DiffuseColor = Vector3.One }); _ship.AddWeapon(new LaserCannon(this, TimeSpan.FromSeconds(0.2d), -1, _ship), GestureType.Tap); AddComponent(_ship, "Models"); }