/// <summary> /// Creates a new spatial object. /// </summary> /// <param name="model">Model</param> /// <param name="position">Posistion</param> /// <param name="azimuth">Azimuth</param> /// <param name="worldTransform">World transform matrix</param> public SpatialObject(Model model, PositionInTown position, double azimuth, Matrix worldTransform) : base(position, azimuth, (model == null ? Vector2.Zero : model.GetSize(worldTransform).XZToVector2())) { Load(model, position, 0, azimuth, worldTransform); }
/// <summary> /// Creates a new spatial object. /// </summary> /// <param name="model">Model</param> /// <param name="quarter">Town quarter</param> /// <param name="positionInQuarter">Position inside the town quarter</param> /// <param name="azimuth">Azimuth</param> /// <param name="worldTransform">World transform matrix</param> public SpatialObject(Model model, TownQuarter quarter, Vector3 positionInQuarter, double azimuth, Matrix worldTransform) : base(new PositionInTown(quarter, positionInQuarter.XZToVector2()), azimuth, (model == null? Vector2.Zero : model.GetSize(worldTransform).XZToVector2())) { Load(model, new PositionInTown(quarter, positionInQuarter.XZToVector2()), positionInQuarter.Y, azimuth, worldTransform); }
protected void Load(Model model, PositionInTown position, float verticalPosition, double azimuth, Matrix worldTransform) { this.model = model; this.verticalPosition = verticalPosition; Vector3 size = Vector3.Zero; if (model != null) { size = model.GetSize(worldTransform); verticalSize = size.Y; } base.Load(position, azimuth, size.XZToVector2()); }