/// <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)); }
/// <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; }
/// <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); }
/// <summary> /// Remove an object of the group /// </summary> /// <param name="sceneObject"></param> public virtual bool Remove(YnEntity3D sceneObject) { return(_members.Remove(sceneObject)); }
public YnGroup3D(YnEntity3D parent) { _members = new YnEntity3DList(); _initialized = false; _parent = parent; }
/// <summary> /// Remove an object3D of the scene /// </summary> /// <param name="object3D">Object3D to remove.</param> public bool Remove(YnEntity3D object3D) { return _scene.Remove(object3D); }
/// <summary> /// Add an object3D on the scene /// </summary> /// <param name="object3D">An object3D</param> public bool Add(YnEntity3D object3D) { return _scene.Add(object3D); }
/// <summary> /// Remove an object of the group /// </summary> /// <param name="sceneObject"></param> public virtual bool Remove(YnEntity3D sceneObject) { return _members.Remove(sceneObject); }
/// <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); }
/// <summary> /// Remove an object3D of the scene /// </summary> /// <param name="object3D">Object3D to remove.</param> public bool Remove(YnEntity3D object3D) { return(_scene.Remove(object3D)); }
/// <summary> /// Add an object3D on the scene /// </summary> /// <param name="object3D">An object3D</param> public bool Add(YnEntity3D object3D) { return(_scene.Add(object3D)); }