コード例 #1
0
        /// <summary>
        /// Casts the plane selection and selects all objects inside the SelectionRectangle.
        /// Hitted objects sends to the GameObjectManager (OnLeftClick).
        /// </summary>
        /// <param name="first">The firts corner.</param>
        /// <param name="second">The second corner.</param>
        private void PerformSelection(Vector2 first, Vector2 second)
        {
            float left = first.x, right = second.x,
                  top = first.y, bottom = second.y;

            if (left > right)
            {
                Swap(ref left, ref right);
            }
            if (top > bottom)
            {
                Swap(ref top, ref bottom);
            }

            if ((right - left) * (bottom - top) < 0.0001)
            {
                return;
            }

            Camera c           = Game.SceneManager.GetCamera("myCam");
            Ray    topLeft     = c.GetCameraToViewportRay(left, top);
            Ray    topRight    = c.GetCameraToViewportRay(right, top);
            Ray    bottomLeft  = c.GetCameraToViewportRay(left, bottom);
            Ray    bottomRight = c.GetCameraToViewportRay(right, bottom);

            PlaneBoundedVolume vol = new PlaneBoundedVolume();

            vol.planes.Add(new Plane(topLeft.GetPoint(3), topRight.GetPoint(3), bottomRight.GetPoint(3)));                // Front plane
            vol.planes.Add(new Plane(topLeft.Origin, topLeft.GetPoint(100), topRight.GetPoint(100)));                     // Top plane
            vol.planes.Add(new Plane(topLeft.Origin, bottomLeft.GetPoint(100), topLeft.GetPoint(100)));                   // Left plane
            vol.planes.Add(new Plane(bottomLeft.Origin, bottomRight.GetPoint(100), bottomLeft.GetPoint(100)));            // Bottom plane
            vol.planes.Add(new Plane(topRight.Origin, topRight.GetPoint(100), bottomRight.GetPoint(100)));                // Right plane

            PlaneBoundedVolumeList volList = new PlaneBoundedVolumeList();

            volList.Add(vol);
            PlaneBoundedVolumeListSceneQuery volQuery = Game.SceneManager.CreatePlaneBoundedVolumeQuery(volList);
            SceneQueryResult result = volQuery.Execute();

            List <MovableObject> list = new List <MovableObject>(result.movables);

            GameObjectManager.GetInstance().OnLeftClick(list);

            Game.SceneManager.DestroyQuery(volQuery);
        }
コード例 #2
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PlaneBoundedVolumeListSceneQuery obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
コード例 #3
0
 /// <summary>
 /// Destroys a Plane Bounded Volume scene query.
 /// </summary>
 /// <param name="query">The query to destroy.</param>
 public void destroyQuery(PlaneBoundedVolumeListSceneQuery query)
 {
     throw new NotImplementedException();
     //SceneManager_destroyQuery(ogreSceneManager, query.NavtiveQuery);
 }