Beispiel #1
0
            /// <summary>Based on the characteristics of the wheel base, returns the amount the wheel should turn</summary>
            /// <param name="wheel">Wheel whose angle we want</param>
            /// <param name="turnLeft">Whether the wheel is turning left or right</param>
            /// <returns>The angle, in degrees</returns>
            public float GetAngle(PowerWheel wheel, bool turnLeft)
            {
                Vector3D delta = (turnLeft ? this.LeftCenterOfTurn : this.RightCenterOfTurn) - wheel.Position;

                delta.Y = 0;
                delta   = Vector3D.Normalize(delta);
                return(MathHelper.ToDegrees((float)Math.Acos(delta.Dot(turnLeft ? LEFT : RIGHT))));
            }
Beispiel #2
0
 private bool displayPowerWheel()
 {
     if (test)
     {
         powerWheel = new PowerWheel();
         return(true);
     }
     return(false);
 }
Beispiel #3
0
            /// <summary>Updates the characteristics of the wheel base</summary>
            /// <param name="wheel">Wheel to add</param>
            public void AddWheel(PowerWheel wheel)
            {
                Vector3D p = wheel.Position;

                this.min.X = Math.Min(p.X, this.min.X);
                this.min.Z = Math.Min(p.Z, this.min.Z);
                this.max.X = Math.Max(p.X, this.max.X);
                this.max.Z = Math.Max(p.Z, this.max.Z);
                this.update();
            }
            /// <summary>Adjusts the suspensions to have the vehicle more level with the ground. Should be activated on level ground</summary>
            public void Calibrate()
            {
                PowerWheel minW = this.wheels[0], maxW = this.wheels.Last();
                double     minZ = minW.Position.Z, maxZ = maxW.Position.Z;
                float      weightPerWheel = this.getShipWeight() / this.wheels.Count;

                this.calibration = new Calibration()
                {
                    Weight  = this.getShipWeight(), // not yet used
                    MaxZ    = maxZ,
                    MinZ    = minZ,
                    MaxMult = maxW.GetForce() / weightPerWheel,
                    MinMult = minW.GetForce() / weightPerWheel,
                };
            }