Exemplo n.º 1
0
        public void HandleCursor()
        {
            Vec3 zero1         = Vec3.Zero;
            Vec3 zero2         = Vec3.Zero;
            Vec2 viewportPoint = this.MissionScreen.SceneLayer.SceneView.ScreenPointToViewportPoint(new Vec2(0.5f, 0.5f));

            this.MissionScreen.CombatCamera.ViewportPointToWorldRay(ref zero1, ref zero2, viewportPoint);
            PathFaceRecord currentFace = new PathFaceRecord();
            Vec3           intersectionPoint;

            GetCursorIntersectionPoint(ref zero1, ref zero2, out float _, out intersectionPoint, ref currentFace, BodyFlags.CommonFocusRayCastExcludeFlags);
            this.MissionScreen.SceneLayer.SceneView.ProjectedMousePositionOnGround(ref intersectionPoint, false, false);
            MatrixFrame frame = this._cursor.GetFrame();

            frame.origin       = intersectionPoint;
            frame.rotation.f   = this.MissionScreen.CombatCamera.Frame.rotation.f;
            frame.rotation.f.z = 0.0f;
            double num1 = (double)frame.rotation.f.Normalize();

            frame.rotation.s   = this.MissionScreen.CombatCamera.Frame.rotation.s;
            frame.rotation.s.z = 0.0f;
            double num2 = (double)frame.rotation.s.Normalize();

            frame.rotation.u = Vec3.CrossProduct(frame.rotation.s, frame.rotation.f);
            frame.rotation.RotateAboutSide(-1.570796f);
            BoundingBox boundingBox = this._cursor.GetMetaMesh(0).GetBoundingBox();
            float       num3        = boundingBox.max.y - boundingBox.min.y;

            frame.Advance(-num3);
            this._cursor.SetFrame(ref frame);
            this._cursor.GetFirstMesh().SetMeshRenderOrder(200);
        }
Exemplo n.º 2
0
        private void GetCursorIntersectionPoint(
            ref Vec3 clippedMouseNear,
            ref Vec3 clippedMouseFar,
            out float closestDistanceSquared,
            out Vec3 intersectionPoint,
            ref PathFaceRecord currentFace,
            BodyFlags excludedBodyFlags = BodyFlags.CommonFocusRayCastExcludeFlags)
        {
            double num = (double)(clippedMouseFar - clippedMouseNear).Normalize();

            this.MissionScreen.SceneLayer.SceneView.GetScene().GetBoundingBox(out Vec3 _, out Vec3 _);
            Vec3  direction   = clippedMouseFar - clippedMouseNear;
            float maxDistance = direction.Normalize();

            this._mouseRay.Reset(clippedMouseNear, direction, maxDistance);
            intersectionPoint      = Vec3.Zero;
            closestDistanceSquared = 1E+12f;
            float collisionDistance;

            if (this.MissionScreen.SceneLayer.SceneView.GetScene().RayCastForClosestEntityOrTerrain(clippedMouseNear, clippedMouseFar, out collisionDistance, 0.01f, excludedBodyFlags))
            {
                closestDistanceSquared = collisionDistance * collisionDistance;
                intersectionPoint      = clippedMouseNear + direction * collisionDistance;
            }
            currentFace = Campaign.Current.MapSceneWrapper.GetFaceIndex(intersectionPoint.AsVec2);
        }
Exemplo n.º 3
0
 public void GetNavMeshFaceIndex(
     ref PathFaceRecord record,
     Vec2 position,
     bool checkIfDisabled,
     bool ignoreHeight = false)
 {
     EngineApplicationInterface.IScene.GetNavMeshFaceIndex(this.Pointer, ref record, position, checkIfDisabled, ignoreHeight);
 }
            public                 PathFaceRecord this[int index]
            {
                get
                {
                    switch (index)
                    {
                    case 0:
                        return(this._element0);

                    case 1:
                        return(this._element1);

                    case 2:
                        return(this._element2);

                    case 3:
                        return(this._element3);

                    case 4:
                        return(this._element4);

                    case 5:
                        return(this._element5);

                    default:
                        return(PathFaceRecord.NullFaceRecord);
                    }
                }
                set
                {
                    switch (index)
                    {
                    case 0:
                        this._element0 = value;
                        break;

                    case 1:
                        this._element1 = value;
                        break;

                    case 2:
                        this._element2 = value;
                        break;

                    case 3:
                        this._element3 = value;
                        break;

                    case 4:
                        this._element4 = value;
                        break;

                    case 5:
                        this._element5 = value;
                        break;
                    }
                }
            }
Exemplo n.º 5
0
 public void GetNavMeshFaceIndex(ref PathFaceRecord record, Vec3 position, bool checkIfDisabled) => EngineApplicationInterface.IScene.GetNavMeshFaceIndex3(this.Pointer, ref record, position, checkIfDisabled);