Пример #1
0
    public void SetUI(JointModule jm)
    {
        currentModule = jm;
        int jointType = 0;

        if (jm.ObjectPath == JOINT_PATH + JointModule.HINGE_JOINT)
        {
        }
        else if (jm.ObjectPath == JOINT_PATH + JointModule.SPRING_JOINT)
        {
            jointType = 1;
        }
        else
        {
            jointType = 2;
        }
        jointDropdown.value = jointType;

        Gravity.isOn             = jm.gravity;
        Mass.Slider.value        = jm.mass;
        Drag.Slider.value        = jm.drag;
        AngularDrag.Slider.value = jm.angularDrag;

        JointLimitMin.Slider.value = jm.jointLimitMin;
        JointLimitMax.Slider.value = jm.jointLimitMax;
        JointDamper.Slider.value   = jm.jointSpringDamper;
        JointSpring.Slider.value   = jm.jointSpringSpring;

        CharacterJointLimitMin.Slider.value = jm.twistLimit1;
        CharacterJointLimitMax.Slider.value = jm.twistLimit2;
        CharacterJointDamper.Slider.value   = jm.twistSpringDamper;
        CharacterJointSpring.Slider.value   = jm.twistSpringSpring;

        TwistAxis.Vector = jm.twistAxis;
    }
Пример #2
0
    public override SystemModule CopyModule()
    {
        JointModule om = new JointModule(Symbol, Age, TerminalAge, Growth, ObjectPath);

        om.mass        = mass;
        om.angularDrag = angularDrag;
        om.drag        = drag;
        om.gravity     = gravity;

        om.jointLimitMin     = jointLimitMin;
        om.jointLimitMax     = jointLimitMax;
        om.jointSpringSpring = jointSpringSpring;
        om.jointSpringDamper = jointSpringDamper;

        om.twistLimit1 = twistLimit1;
        om.twistLimit2 = twistLimit2;

        om.twistSpringSpring = twistSpringSpring;
        om.twistSpringDamper = twistSpringDamper;
        return(om);
    }
Пример #3
0
    // Use this for initialization
    public void Init(JointModule jm)
    {
        currentModule = jm;
        SetJoint();
        UpdateJoint();

        SetJointLimitMin();
        SetJointLimitMax();
        SetDamper();
        SetSpring();

        SetTwistAxis();
        SetTwistLimitMin();
        SetTwistLimitMax();
        SetTwistDamper();
        SetTwistSpring();

        SetMass();
        SetGravity();
        SetDrag();
        SetAngularDrag();
    }
    public void BuildDefaultSystem()
    {
        ObjectModule om = new ObjectModule('O', 0, 1, GrowthList.LINEAR, ObjectBuilder.OBJECT_PATH + ObjectList.SIMPLE_LEAF);

        om.scale    = Vector3.one * 0.1f;
        om.rotation = new Vector3(90, 0, 0);

        ObjectModule om_right = new ObjectModule('O', 0, 1, GrowthList.LINEAR, ObjectBuilder.OBJECT_PATH + ObjectList.SIMPLE_LEAF);

        om_right.scale    = Vector3.one * 0.1f;
        om_right.rotation = new Vector3(90, 180, 0);
        om_right.jointed  = true;

        JointModule jm = new JointModule('{', 0, 1, GrowthList.LINEAR, JointBuilder.JOINT_PATH + JointModule.HINGE_JOINT);

        jm.jointSpringSpring = 10f;
        jm.jointSpringDamper = 99f;

        jm.jointLimitMin = -10;
        jm.jointLimitMax = 10;

        ObjectModule om_right_z = new ObjectModule('O', 0, 1, GrowthList.LOGISTIC, ObjectBuilder.OBJECT_PATH + ObjectList.SIMPLE_LEAF);

        om_right_z.scale    = Vector3.one * 0.1f;
        om_right_z.rotation = new Vector3(90, 90, 0);

        JointModule jmc = new JointModule('{', 0, 1, GrowthList.LINEAR, JointBuilder.JOINT_PATH + JointModule.CHARACTER_JOINT);

        jmc.mass = 1;

        jmc.jointSpringSpring = 10f;
        jmc.jointSpringDamper = 99f;

        jmc.jointLimitMin = -10;
        jmc.jointLimitMax = 10;

        jmc.twistLimit1 = -10;
        jmc.twistLimit2 = 10;

        jmc.twistSpringSpring = 10f;
        jmc.twistSpringDamper = 99f;

        LineModule ln = new LineModule('F', 0, 1, GrowthList.EXPONENTIAL);

        ln.LineWidth  = 0.1f;
        ln.LineLength = 0.1f;
        ln.jointed    = true;

        ObjectModule om_z = new ObjectModule('O', 0, 1, GrowthList.LINEAR, ObjectBuilder.OBJECT_PATH + ObjectList.SIMPLE_LEAF);

        om_z.scale    = Vector3.one * 0.1f;
        om_z.rotation = new Vector3(90, -90, 0);

        List <SystemModule> lm = new List <SystemModule>();

        lm.Add(jmc.CopyModule());
        lm.Add(ln.CopyModule());
        lm.Add(new SystemModule('[', 0, 1, GrowthList.NON_DEVELOPMENTAL));
        lm.Add(jm.CopyModule());
        lm.Add(new RotationModule('+', 0, 1, GrowthList.LINEAR, new Vector3(1, 0, 0), 45f));
        lm.Add(om_right.CopyModule());
        lm.Add(new SystemModule('}', 0, 1, GrowthList.NON_DEVELOPMENTAL));
        lm.Add(new SystemModule(']', 0, 1, GrowthList.NON_DEVELOPMENTAL));
        lm.Add(new SystemModule('1', 0, 1, GrowthList.NON_DEVELOPMENTAL));
        lm.Add(new SystemModule('}', 0, 1, GrowthList.NON_DEVELOPMENTAL));

        Productions.Add('1', lm);
    }