Beispiel #1
0
        public IEnumerable <WheelDescription> GetWheels(CarSuspensionModifiers modifiers = null)
        {
            if (IsEmpty)
            {
                yield break;
            }

            var tyres = _data.GetIniFile("tyres.ini");
            var front = tyres["FRONT"];
            var rear  = tyres["REAR"];

            var suspension    = _data.GetIniFile("suspensions.ini");
            var wheelbase     = suspension["BASIC"].GetFloat("WHEELBASE", 2.4f);
            var cgLocation    = suspension["BASIC"].GetFloat("CG_LOCATION", 0.5f);
            var frontTrack    = suspension["FRONT"];
            var rearTrack     = suspension["REAR"];
            var graphicOffset = suspension["GRAPHICS_OFFSETS"];

            yield return(new WheelDescription("LF", front, frontTrack, graphicOffset, wheelbase, cgLocation, true, true, modifiers));

            yield return(new WheelDescription("RF", front, frontTrack, graphicOffset, wheelbase, cgLocation, false, true, modifiers));

            yield return(new WheelDescription("LR", rear, rearTrack, graphicOffset, wheelbase, cgLocation, true, false, modifiers));

            yield return(new WheelDescription("RR", rear, rearTrack, graphicOffset, wheelbase, cgLocation, false, false, modifiers));
        }
Beispiel #2
0
            internal WheelDescription(string name, IniFileSection wheelsPairSection, IniFileSection axleSection, IniFileSection graphicOffsetSection,
                                      float wheelbase, float cgLocation, bool left, bool front, [CanBeNull] CarSuspensionModifiers modifiers)
            {
                Name         = name;
                BaseY        = axleSection.GetFloat("BASEY", 0f) + ((front ? modifiers?.BaseYFrontAdd : modifiers?.BaseYRearAdd) ?? 0f);
                StaticCamber = axleSection.GetFloat("STATIC_CAMBER", 0f) + ((front ? modifiers?.CamberFrontAdd : modifiers?.CamberRearAdd) ?? 0f);
                StaticToe    = (front ? modifiers?.ToeFrontAdd : modifiers?.ToeRearAdd) ?? 0f;

                var baseCenter = new Vector3(
                    (left ? 0.5f : -0.5f) * (
                        axleSection.GetFloat("TRACK", 1.4f) +
                        ((front ? modifiers?.TrackWidthFrontAdd : modifiers?.TrackWidthRearAdd) ?? 0f)),
                    BaseY,
                    (front ? 1f - cgLocation : -cgLocation) * wheelbase + ((front ? modifiers?.ZOffsetFrontAdd : modifiers?.ZOffsetRearAdd) ?? 0f));

                CenterWheel = baseCenter + new Vector3(graphicOffsetSection.GetFloat("WHEEL_" + name, 0f), 0f, 0f);
                CenterSusp  = baseCenter + new Vector3(graphicOffsetSection.GetFloat("SUSP_" + name, 0f), 0f, 0f);
                Radius      = wheelsPairSection.GetFloat("RADIUS", 0.3f);
                RimRadius   = wheelsPairSection.GetFloat("RIM_RADIUS", 0.23f) - 0.0254f;
                Width       = wheelsPairSection.GetFloat("WIDTH", 0.2f);
            }