Ejemplo n.º 1
0
 // Clamp The Geometry To The Heightmap
 public static void CollideHeightmap(ICollidable o, CollisionGrid map)
 {
     if (!o.IsStatic)
     {
         o.Height = map.HeightAt(o.Center);
     }
 }
Ejemplo n.º 2
0
        public void Update(CollisionGrid map, float dt)
        {
            CameraMotionSettings cms = MovementSettings;

            Scroll(camController.ScrollX, camController.ScrollZ, cms, dt);
            Orbit(camController.Yaw, camController.Pitch, cms, dt);
            int z;

            camController.GetZoom(out z);
            Zoom(z, dt);
            camTarget.X = MathHelper.Clamp(camTarget.X, 0, map.size.X);
            camTarget.Z = MathHelper.Clamp(camTarget.Z, 0, map.size.Y);
            //camOrigin.Y = Grey.Vox.Region.HEIGHT * 0.5f; // MathHelper.Clamp(camOrigin.Y, 0, Grey.Vox.Region.HEIGHT);
            camTarget.Y = map.HeightAt(new Vector2(camOrigin.X, camTarget.Z));

            bool reset;

            camController.GetResetDefault(out reset);
            if (reset)
            {
                Yaw       = INITIAL_CAMERA_YAW;
                Pitch     = INITIAL_CAMERA_PITCH;
                ZoomRatio = INITIAL_ZOOM_RATIO;
            }

            camOrigin = Tweens.LINEAR.GetValue(camOrigin, camTarget, TWEEN_FACTOR * dt);
            RecalculateView(map, MathHelper.Lerp(cms.MinDistance, cms.MaxDistance, ZoomRatio));
        }