Exemple #1
0
        private void PerformJump(Vector3D jumpTarget)
        {
            m_updateEffectPosition = false;
            m_jumpDirection        = jumpTarget - m_grid.WorldMatrix.Translation;

            BoundingBoxD aggregateBox = m_grid.PositionComp.WorldAABB;

            foreach (var grid in m_shipInfo.Keys)
            {
                aggregateBox.Include(grid.PositionComp.WorldAABB);
            }

            MyPhysics.EnsurePhysicsSpace(aggregateBox + m_jumpDirection);

            bool updateSpectator = false;

            if (IsLocalCharacterAffectedByJump())
            {
                updateSpectator = true;
            }

            if (updateSpectator)
            {
                MyThirdPersonSpectator.Static.ResetViewerAngle(null);
                MyThirdPersonSpectator.Static.ResetViewerDistance();
                MyThirdPersonSpectator.Static.RecalibrateCameraPosition();
            }

            m_jumped = true;

            foreach (var grid in m_shipInfo.Keys)
            {
                MatrixD gridMatrix = grid.WorldMatrix;
                gridMatrix.Translation = grid.WorldMatrix.Translation + m_jumpDirection;
                grid.WorldMatrix       = gridMatrix;
            }

            if (updateSpectator)
            {
                MyThirdPersonSpectator.Static.ResetViewerAngle(null);
                MyThirdPersonSpectator.Static.ResetViewerDistance();
                MyThirdPersonSpectator.Static.RecalibrateCameraPosition();
            }
        }