コード例 #1
0
        private void CopyTriangle(MyNavigationTriangle otherTri, Vector3I triPosition, ref MatrixI transform)
        {
            Vector3 vector;
            Vector3 vector2;
            Vector3 vector3;

            otherTri.GetTransformed(ref transform, out vector, out vector2, out vector3);
            if (MyPerGameSettings.NavmeshPresumesDownwardGravity)
            {
                Vector3 vector4 = Vector3.Cross(vector3 - vector, vector2 - vector);
                vector4.Normalize();
                if (Vector3.Dot(vector4, Base6Directions.GetVector(Base6Directions.Direction.Up)) < 0.7f)
                {
                    return;
                }
            }
            Vector3I.Transform(ref triPosition, ref transform, out triPosition);
            MyNavigationTriangle tri = this.AddTriangleInternal(vector, vector3, vector2);

            this.RegisterTriangleInternal(tri, ref triPosition);
        }
コード例 #2
0
        private void CopyTriangle(MyNavigationTriangle otherTri, Vector3I triPosition, ref MatrixI transform)
        {
            Vector3 newA, newB, newC;

            otherTri.GetTransformed(ref transform, out newA, out newB, out newC);

            if (MyFakes.NAVMESH_PRESUMES_DOWNWARD_GRAVITY)
            {
                Vector3 n = Vector3.Cross(newC - newA, newB - newA);
                n.Normalize();
                if (Vector3.Dot(n, Base6Directions.GetVector(Base6Directions.Direction.Up)) < 0.7f)
                {
                    return;                                                                                 // Slightly lower than sqrt(2)/2 = 45 deg
                }
            }

            Vector3I.Transform(ref triPosition, ref transform, out triPosition);

            // This is not an error - we need to swap C and B from the navmesh,
            // because they will be swapped again when the triangle is added
            var tri = AddTriangleInternal(newA, newC, newB);

            RegisterTriangleInternal(tri, ref triPosition);
        }
コード例 #3
0
        private void CopyTriangle(MyNavigationTriangle otherTri, Vector3I triPosition, ref MatrixI transform)
        {
            Vector3 newA, newB, newC;
            otherTri.GetTransformed(ref transform, out newA, out newB, out newC);

            if (MyFakes.NAVMESH_PRESUMES_DOWNWARD_GRAVITY)
            {
                Vector3 n = Vector3.Cross(newC - newA, newB - newA);
                n.Normalize();
                if (Vector3.Dot(n, Base6Directions.GetVector(Base6Directions.Direction.Up)) < 0.7f) return; // Slightly lower than sqrt(2)/2 = 45 deg
            }

            Vector3I.Transform(ref triPosition, ref transform, out triPosition);

            // This is not an error - we need to swap C and B from the navmesh,
            // because they will be swapped again when the triangle is added
            var tri = AddTriangleInternal(newA, newC, newB);
            RegisterTriangleInternal(tri, ref triPosition);
        }