public Camera() { this.Position = new Vector3(0, 0, 0); this.Yaw = MathHelper.ToDegrees(MathHelper.PiOver2); this.Pitch = MathHelper.ToDegrees(-MathHelper.Pi / 10.0f); this.Distance = 1; }
public virtual void Update(float dT) { // this.Heading += dT*10; float dH = 0.1f; Vector3 Movevector = new Vector3(dT, 0, 0); Vector3 advance = Point(Movevector, OnGround || Gravity); Interfaces.WorldPosition next = this.Position + advance * Speed; float h1 = WorldSpawn.Terrain.GetHeight(this.Position.Truncate(), this.Position.Reference()); float h2 = WorldSpawn.Terrain.GetHeight(next.Truncate(), next.Reference()); if (h2 - h1 < dH) { this.Position = next; } if (!OnGround && Gravity) { this.Position.Y += this.VerticalSpeed * dT; } if (this.Model != null) { // if (this.Speed == 0) // this.Model.ApplyAnimation("Straighten"); // else // this.Model.ApplyAnimation("Walk"); } }
public void Aim(Interfaces.WorldPosition Target, bool flatten) { Interfaces.WorldPosition diff = Target - this.Position; Vector3 v = diff; v.Normalize(); this.Heading = (float)(Math.Atan2(v.X, v.Z) / MathHelper.Pi * -180f) + 90f; if (!flatten) { this.Pitch = (float)(Math.Asin(-v.Y) / MathHelper.Pi * -180f); } }
public virtual void Update(float dT) { // this.Heading += dT*10; Vector3 Movevector = new Vector3(dT, 0, 0); Vector3 advance = Point(Movevector, OnGround || Gravity); this.Position += advance * Speed; if (!OnGround && Gravity) { this.Position.Y += this.VerticalSpeed * dT; } if (this.Model != null) { // if (this.Speed == 0) // this.Model.ApplyAnimation("Straighten"); // else // this.Model.ApplyAnimation("Walk"); } }
public Matrix CreateWorld(WorldPosition a) { return(Matrix.CreateTranslation(this.WRT(a))); }