void Set_Parent_Script(GameObject newObject)
        {
            // Set 'Static_Track_CS' script as parent.
            PTS_Static_Track_CS trackScript = newObject.AddComponent <PTS_Static_Track_CS> ();

            trackScript.Type             = 9;                                                                                                              // Parent ;
            trackScript.Length           = Collider_InfoProp.boundsValue.size.z;
            trackScript.Stored_Body_Mass = thisTransform.parent.GetComponent <Rigidbody> ().mass + (Track_MassProp.floatValue * thisTransform.childCount); // to increase the MainBody's Mass.
            PTS_Drive_Control_CS driveControlScript = thisTransform.parent.GetComponent <PTS_Drive_Control_CS> ();

            if (driveControlScript)
            {
                trackScript.Stored_Torque = driveControlScript.Torque * 1.25f;                 // to increase Torque.
            }
            // Store suspension angles.
            PTS_Create_RoadWheel_CS [] wheelParentScripts  = thisTransform.parent.GetComponentsInChildren <PTS_Create_RoadWheel_CS> ();
            RoadWheelsProp[]           roadWheelsPropArray = new RoadWheelsProp [wheelParentScripts.Length];
            for (int i = 0; i < wheelParentScripts.Length; i++)
            {
                roadWheelsPropArray [i] = wheelParentScripts [i].Get_Current_Angles();
            }
            trackScript.RoadWheelsProp_Array = roadWheelsPropArray;
            // Change children's parent.
            int childCount = thisTransform.childCount;

            for (int i = 0; i < childCount; i++)
            {
                Transform childTransform = thisTransform.GetChild(0);
                childTransform.parent = newObject.transform;
            }
        }
 void Awake()
 {
     thisRigidbody = GetComponent <Rigidbody> ();
     thisTransform = transform;
     // Set isLeft
     isLeft = (thisTransform.localEulerAngles.z == 0.0f);
     // Get reference
     driveControlScript = GetComponentInParent <PTS_Drive_Control_CS> ();
     maxAngVelocity     = Mathf.Deg2Rad * ((driveControlScript.Max_Speed / (2.0f * Radius * Mathf.PI)) * 360.0f);
     maxAngVelocity     = Mathf.Clamp(maxAngVelocity, 0.0f, driveControlScript.MaxAngVelocity_Limit);          // To solve physics issues in the default physics quality.
 }
        void Auto_Set_Others()
        {
            // MainBody (Increase the Mass)
            Transform bodyTransform            = Selection.activeGameObject.transform.parent;
            PTS_MainBody_Setting_CS bodyScript = bodyTransform.GetComponent <PTS_MainBody_Setting_CS> ();

            if (bodyScript.Body_Mass < Stored_Body_MassProp.floatValue)
            {
                bodyScript.Body_Mass = Stored_Body_MassProp.floatValue;
            }
            bodyScript.SIC = 10;
            // Drive_Control_CS (Increase the Torque and Turn_Brake_Drag)
            PTS_Drive_Control_CS driveControlScript = bodyTransform.GetComponent <PTS_Drive_Control_CS> ();

            if (driveControlScript.Torque < Stored_TorqueProp.floatValue)
            {
                driveControlScript.Torque = Stored_TorqueProp.floatValue;
            }
            driveControlScript.Fix_Useless_Rotaion = false;
            // IdlerWheel
            PTS_Create_IdlerWheel_CS [] idlerScripts = bodyTransform.GetComponentsInChildren <PTS_Create_IdlerWheel_CS> ();
            for (int i = 0; i < idlerScripts.Length; i++)
            {
                idlerScripts [i].Static_Flag = true;
            }
            // SprocketWheel
            PTS_Create_SprocketWheel_CS [] sprocketScripts = bodyTransform.GetComponentsInChildren <PTS_Create_SprocketWheel_CS> ();
            for (int i = 0; i < sprocketScripts.Length; i++)
            {
                sprocketScripts [i].Static_Flag = true;
            }
            // SupportWheel
            PTS_Create_SupportWheel_CS [] supportScripts = bodyTransform.GetComponentsInChildren <PTS_Create_SupportWheel_CS> ();
            for (int i = 0; i < supportScripts.Length; i++)
            {
                supportScripts [i].Static_Flag = true;
            }
            // RoadWheel
            PTS_Create_RoadWheel_CS [] roadWheeScripts = bodyTransform.GetComponentsInChildren <PTS_Create_RoadWheel_CS> ();
            for (int i = 0; i < roadWheeScripts.Length; i++)
            {
                roadWheeScripts [i].Fit_ST_Flag = true;
            }
        }