Esempio n. 1
0
 public ChShaftsBody(ChShaftsBody other)
 {
     torque_react = other.torque_react;
     shaft_dir    = other.shaft_dir;
     shaft        = null;
     body         = null;
 }
Esempio n. 2
0
        public void Set_eng_mode(eCh_eng_mode mset)
        {
            if (Get_learn())
            {
                Set_learn(false);  // reset learn state when changing mode
            }
            if (eng_mode != mset)
            {
                eng_mode = mset;

                switch (eng_mode)
                {
                case eCh_eng_mode.ENG_MODE_ROTATION:
                case eCh_eng_mode.ENG_MODE_SPEED:
                case eCh_eng_mode.ENG_MODE_KEY_ROTATION:
                    ((ChLinkMaskLF)mask).Constr_E3().SetMode(eChConstraintMode.CONSTRAINT_LOCK);
                    break;

                case eCh_eng_mode.ENG_MODE_KEY_POLAR:
                    ((ChLinkMaskLF)mask).Constr_E1().SetMode(eChConstraintMode.CONSTRAINT_LOCK);
                    ((ChLinkMaskLF)mask).Constr_E2().SetMode(eChConstraintMode.CONSTRAINT_LOCK);
                    ((ChLinkMaskLF)mask).Constr_E3().SetMode(eChConstraintMode.CONSTRAINT_LOCK);
                    break;

                case eCh_eng_mode.ENG_MODE_TORQUE:
                    ((ChLinkMaskLF)mask).Constr_E3().SetMode(eChConstraintMode.CONSTRAINT_FREE);
                    break;

                case eCh_eng_mode.ENG_MODE_TO_POWERTRAIN_SHAFT:
                    ((ChLinkMaskLF)mask).Constr_E3().SetMode(eChConstraintMode.CONSTRAINT_FREE);
                    innerconstraint1 = gameObject.AddComponent <ChShaftsBody>();
                    innerconstraint2 = gameObject.AddComponent <ChShaftsBody>();
                    innershaft1      = gameObject.AddComponent <ChShaft>();
                    innershaft2      = gameObject.AddComponent <ChShaft>();
                    SetUpMarkers(marker1, marker2);      // to initialize innerconstraint1 innerconstraint2
                    break;
                }

                ChangedLinkMask();  // update all from new mask
            }

            if (eng_mode == eCh_eng_mode.ENG_MODE_KEY_ROTATION && rot_funct.Get_Type() != ChFunction.FunctionType.FUNCT_CONST)
            {
                rot_funct = new ChFunction_Const();
            }

            if (eng_mode == eCh_eng_mode.ENG_MODE_KEY_POLAR)
            {
                if (rot_funct.Get_Type() != ChFunction.FunctionType.FUNCT_CONST)
                {
                    rot_funct = new ChFunction_Const();
                }
                if (rot_funct_x.Get_Type() != ChFunction.FunctionType.FUNCT_CONST)
                {
                    rot_funct_x = new ChFunction_Const();
                }
                if (rot_funct_y.Get_Type() != ChFunction.FunctionType.FUNCT_CONST)
                {
                    rot_funct_y = new ChFunction_Const();
                }
            }
        }