Exemple #1
0
        /// <summary>
        /// Add an object to the group, the camera used for this group will be used for this object
        /// </summary>
        /// <param name="sceneObject">An object3D</param>
        public virtual bool Add(YnEntity3D sceneObject)
        {
            if (sceneObject is YnScene3D)
            {
                throw new Exception("[YnGroup3D] You can't add a scene on a group, use an YnGroup3D instead");
            }

            if (sceneObject == this)
            {
                throw new Exception("[YnGroup3D] You can't add this group");
            }

            sceneObject.Parent = this;

            if (_assetLoaded)
            {
                sceneObject.LoadContent();
            }

            if (_initialized)
            {
                sceneObject.Initialize();
            }

            return(_members.Add(sceneObject));
        }
Exemple #2
0
        /// <summary>
        /// Get the distance between the mouse cursor and an object3D
        /// </summary>
        /// <param name="camera">Camera to use</param>
        /// <param name="object3D">Object3D</param>
        /// <returns>The distance between the object and the mouse cursor, -1 if not collide</returns>
        public static float MouseCollideWithObject(BaseCamera camera, YnEntity3D object3D)
        {
            float? distance = null;

            if (object3D.Dynamic)
                object3D.UpdateBoundingVolumes();

            distance = GetMouseRay(camera).Intersects(object3D.BoundingBox);

            return distance != null ? (float)distance : -1.0f;
        }
Exemple #3
0
        /// <summary>
        /// Get the distance between the mouse cursor and an object3D
        /// </summary>
        /// <param name="camera">Camera to use</param>
        /// <param name="object3D">Object3D</param>
        /// <returns>The distance between the object and the mouse cursor, -1 if not collide</returns>
        public static float MouseCollideWithObject(BaseCamera camera, YnEntity3D object3D)
        {
            float?distance = null;

            if (object3D.Dynamic)
            {
                object3D.UpdateBoundingVolumes();
            }

            distance = GetMouseRay(camera).Intersects(object3D.BoundingBox);

            return(distance != null ? (float)distance : -1.0f);
        }
Exemple #4
0
 /// <summary>
 /// Remove an object of the group
 /// </summary>
 /// <param name="sceneObject"></param>
 public virtual bool Remove(YnEntity3D sceneObject)
 {
     return(_members.Remove(sceneObject));
 }
Exemple #5
0
 public YnGroup3D(YnEntity3D parent)
 {
     _members     = new YnEntity3DList();
     _initialized = false;
     _parent      = parent;
 }
Exemple #6
0
 /// <summary>
 /// Remove an object3D of the scene
 /// </summary>
 /// <param name="object3D">Object3D to remove.</param>
 public bool Remove(YnEntity3D object3D)
 {
     return _scene.Remove(object3D);
 }
Exemple #7
0
 /// <summary>
 /// Add an object3D on the scene
 /// </summary>
 /// <param name="object3D">An object3D</param>
 public bool Add(YnEntity3D object3D)
 {
     return _scene.Add(object3D);
 }
Exemple #8
0
 /// <summary>
 /// Remove an object of the group
 /// </summary>
 /// <param name="sceneObject"></param>
 public virtual bool Remove(YnEntity3D sceneObject)
 {
     return _members.Remove(sceneObject);
 }
Exemple #9
0
        /// <summary>
        /// Add an object to the group, the camera used for this group will be used for this object
        /// </summary>
        /// <param name="sceneObject">An object3D</param>
        public virtual bool Add(YnEntity3D sceneObject)
        {
            if (sceneObject is YnScene3D)
                throw new Exception("[YnGroup3D] You can't add a scene on a group, use an YnGroup3D instead");

            if (sceneObject == this)
                throw new Exception("[YnGroup3D] You can't add this group");

            sceneObject.Parent = this;

            if (_assetLoaded)
                sceneObject.LoadContent();

            if (_initialized)
                sceneObject.Initialize();

            return _members.Add(sceneObject);
        }
Exemple #10
0
 public YnGroup3D(YnEntity3D parent)
 {
     _members = new YnEntity3DList();
     _initialized = false;
     _parent = parent;
 }
Exemple #11
0
 /// <summary>
 /// Remove an object3D of the scene
 /// </summary>
 /// <param name="object3D">Object3D to remove.</param>
 public bool Remove(YnEntity3D object3D)
 {
     return(_scene.Remove(object3D));
 }
Exemple #12
0
 /// <summary>
 /// Add an object3D on the scene
 /// </summary>
 /// <param name="object3D">An object3D</param>
 public bool Add(YnEntity3D object3D)
 {
     return(_scene.Add(object3D));
 }