Esempio n. 1
0
 public head()
 {
     // main case
     joints    = new metaball[2];
     bones     = new head_bone[1];
     joints[0] = new metaball(0, 0, 0, 1);
     joints[1] = new metaball(2, 0, 0, 1);
     bones[0]  = new head_bone(joints[0], joints[1]);
 }
Esempio n. 2
0
            public bone(metaball lower, metaball upper)
            {
                upper_joint = upper;
                lower_joint = lower;
                Vector3 lowpos = new Vector3(lower.X, lower.Y, lower.Z);
                Vector3 upppos = new Vector3(upper.X, upper.Y, upper.Z);

                length       = (upppos - lowpos).magnitude;
                height_angle = 0;
                plane_angle  = 0;
                update_upper_joint_coordinates();
            }
Esempio n. 3
0
            public leg(int number_of_joints)
            {
                //leg constructor
                int no_j = number_of_joints;

                if (!(number_of_joints < 5 && number_of_joints > 1))
                {
                    Debug.Log("WARNING: a leg must have between 2 and 4 joints, defaulting to 4");
                    no_j = 4;
                }
                // main case
                joints = new metaball[no_j];
                bones  = new leg_bone[no_j - 1];
                for (int i = 0; i < joints.Length; i++)
                {
                    joints[i] = new metaball(i * 2, 0, 0, 1);
                }
                for (int i = 0; i < bones.Length; i++)
                {
                    // associating each bone with a joint
                    bones[i] = new leg_bone(joints[i], joints[i + 1]);
                }
            }
Esempio n. 4
0
            public body(int number_of_joints)
            {
                //leg constructor
                int no_j = number_of_joints;

                if (!(number_of_joints < 4 && number_of_joints > 1))
                {
                    Debug.Log("WARNING: a body must have between 2 and 3 joints, defaulting to 3");
                    no_j = 3;
                }
                // main case
                joints = new metaball[no_j];
                bones  = new body_bone[no_j - 1];
                for (int i = 0; i < joints.Length; i++)
                {
                    joints[i] = new metaball(i * 2, 0, 0, 1);
                }
                // associating each bone with a joint
                bones[0] = new body_bone(joints[0], joints[1]);
                if (no_j == 3)
                {
                    bones[1] = new body_bone(joints[0], joints[2]);
                }
            }
Esempio n. 5
0
 public head_bone(metaball lower, metaball upper) : base(lower, upper)
 {
 }                                                                           //inheritance constructor