public Vector3 CalculateCentralPoint(R3DBoundingBox boundingBox) { return(new Vector3( 0.5f * (boundingBox.Size.X + boundingBox.Org.X), 0.5f * (boundingBox.Size.Y + boundingBox.Org.Y), 0.5f * (boundingBox.Size.Z + boundingBox.Org.Z) )); }
public Vector3 CalculateCentralPoint() { R3DBoundingBox BoundingBox = CalculateBoundingBox(); return(new Vector3( 0.5f * (BoundingBox.Size.X + BoundingBox.Org.X), 0.5f * (BoundingBox.Size.Y + BoundingBox.Org.Y), 0.5f * (BoundingBox.Size.Z + BoundingBox.Org.Z) )); }
/// <summary> /// Initializes a new <see cref="MOBObject"/> from a <see cref="BinaryReader"/> /// </summary> /// <param name="br">The <see cref="BinaryReader"/> to read from</param> public MOBObject(BinaryReader br) { this.Name = Encoding.ASCII.GetString(br.ReadBytes(62)).Replace("\0", ""); this.Type = (MOBObjectType)br.ReadByte(); this.IgnoreCollisionOnPlacement = br.ReadBoolean(); this.Position = new Vector3(br); this.Rotation = new Vector3(br); this.Scale = new Vector3(br); this.BoundingBox = new R3DBoundingBox(br); this.SkinID = br.ReadUInt32(); }
/// <summary> /// Initializes a new <see cref="MOBObject"/> /// </summary> /// <param name="name">Name of this <see cref="MOBObject"/></param> /// <param name="type">Type of this <see cref="MOBObject"/></param> /// <param name="skinID">Skin ID of this <see cref="MOBObject"/></param> /// <param name="ignoreCollisionOnPlacement">Collision flag of this <see cref="MOBObject"/></param> /// <param name="position">Position of this <see cref="MOBObject"/></param> /// <param name="rotation">Scale of this <see cref="MOBObject"/></param> /// <param name="scale">Scale of this <see cref="MOBObject"/></param> /// <param name="boundingBox">Bounding Box of this <see cref="MOBObject"/></param> public MOBObject(string name, MOBObjectType type, uint skinID, bool ignoreCollisionOnPlacement, Vector3 position, Vector3 rotation, Vector3 scale, R3DBoundingBox boundingBox) { this.Name = name; this.Type = type; this.SkinID = skinID; this.IgnoreCollisionOnPlacement = ignoreCollisionOnPlacement; this.Position = position; this.Rotation = rotation; this.Scale = scale; this.BoundingBox = boundingBox; }