Example #1
0
        public static YnEntity3D[] CubeCollide(BaseCamera camera, YnGroup3D group)
        {
            List <YnEntity3D> collides = new List <YnEntity3D>();

            int groupSize = group.Count;

            for (int i = 0; i < groupSize; i++)
            {
                if (camera.BoundingBox.Intersects(group[i].BoundingBox))
                {
                    collides.Add(group[i]);
                }
            }

            return(collides.ToArray());
        }
Example #2
0
        /// <summary>
        /// Test if the model colliding another objects with there bounding box
        /// </summary>
        /// <param name="model">The model</param>
        /// <param name="group">A collection of models</param>
        /// <returns>Array of models that collides with model</returns>
        public static YnMeshModel[] CubeCollide(YnMeshModel model, YnGroup3D group)
        {
            List <YnMeshModel> collides = new List <YnMeshModel>();

            int groupSize = group.Count;

            for (int i = 0; i < groupSize; i++)
            {
                if (group[i] is YnMeshModel)
                {
                    if (CubeCollide(model, group[i] as YnMeshModel))
                    {
                        collides.Add(group[i] as YnMeshModel);
                    }
                }
            }

            return(collides.ToArray());
        }
Example #3
0
        /// <summary>
        /// Check if the mouse cursor collide with a group of object on the scene
        /// </summary>
        /// <param name="camera">Active camera</param>
        /// <param name="group">Group of object</param>
        /// <returns></returns>
        public static CollideInformation[] MouseCollideWithGroup(BaseCamera camera, YnGroup3D group)
        {
            List <CollideInformation> collides = new List <CollideInformation>();

            int groupSize = group.Count;

            for (int i = 0; i < groupSize; i++)
            {
                float distance = MouseCollideWithObject(camera, group[i]);

                if (distance > -1)
                {
                    collides.Add(new CollideInformation()
                    {
                        Object3D = group[i], Distance = distance
                    });
                }
            }

            return(collides.ToArray());
        }
Example #4
0
        /// <summary>
        /// Check if the mouse cursor collide with a group of object on the scene
        /// </summary>
        /// <param name="camera">Active camera</param>
        /// <param name="group">Group of object</param>
        /// <returns></returns>
        public static CollideInformation[] MouseCollideWithGroup(BaseCamera camera, YnGroup3D group)
        {
            List<CollideInformation> collides = new List<CollideInformation>();

            int groupSize = group.Count;

            for (int i = 0; i < groupSize; i++)
            {
                float distance = MouseCollideWithObject(camera, group[i]);

                if (distance > -1)
                    collides.Add(new CollideInformation() { Object3D = group[i], Distance = distance });
            }

            return collides.ToArray();
        }
Example #5
0
        public static YnEntity3D[] CubeCollide(BaseCamera camera, YnGroup3D group)
        {
            List<YnEntity3D> collides = new List<YnEntity3D>();

            int groupSize = group.Count;

            for (int i = 0; i < groupSize; i++)
            {
                if (camera.BoundingBox.Intersects(group[i].BoundingBox))
                    collides.Add(group[i]);
            }

            return collides.ToArray();
        }
Example #6
0
        /// <summary>
        /// Test if the model colliding another objects with there bounding box
        /// </summary>
        /// <param name="model">The model</param>
        /// <param name="group">A collection of models</param>
        /// <returns>Array of models that collides with model</returns>
        public static YnMeshModel[] CubeCollide(YnMeshModel model, YnGroup3D group)
        {
            List<YnMeshModel> collides = new List<YnMeshModel>();

            int groupSize = group.Count;

            for (int i = 0; i < groupSize; i++)
            {
                if (group[i] is YnMeshModel)
                {
                    if (CubeCollide(model, group[i] as YnMeshModel))
                        collides.Add(group[i] as YnMeshModel);
                }
            }

            return collides.ToArray();
        }