예제 #1
0
 public FlyingFPSCamera(Vector3 position, Point screenCenter, ICollisionGrid grid)
     : base()
 {
     _screenCenter = screenCenter;
     Mouse.SetPosition(screenCenter.X, screenCenter.Y);
     Transform.LocalPosition = position;
     _bounds        = new Bounds(Vector3.One * 1.5f);
     _bounds.Center = position;
     _scroll        = Mouse.GetState().ScrollWheelValue;
     _grid          = grid;
 }
예제 #2
0
        public static bool CheckBounds(this ICollisionGrid grid, Bounds bounds, Region exclude)
        {
            var region = bounds.GetBoundingRegion();

            for (int i = region.Min.X; i < region.Max.X; i++)
            {
                for (int j = region.Min.Y; j < region.Max.Y; j++)
                {
                    for (int k = region.Min.Z; k < region.Max.Z; k++)
                    {
                        var c = new Coords(i, j, k);
                        if (!exclude.Contains(c) && grid.CellIsSolid(c))
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
예제 #3
0
 public PhysicsDomain(GravityField gravity, ICollisionGrid collisionGrid)
 {
     Gravity       = gravity;
     CollisionGrid = collisionGrid;
     _bodies       = new HashSet <IPhysicsBody>();
 }