public TransformNode(Transform transform,
                      Transform parent_transform,
                      MuscleMotion.Parts parts,
                      MuscleMotion.Parts parent_parts)
 {
     transform_        = transform;
     parent_transform_ = parent_transform;
     parts_            = parts;
     parent_parts_     = parent_parts;
 }
示例#2
0
 public NodeData getNodeData(MuscleMotion.Parts parts)
 {
     foreach (var node_data in node_data_list_)
     {
         if (node_data.node_idx_ == (int)parts)
         {
             return(node_data);
         }
     }
     Debug.Assert(false);
     return(new NodeData());
 }
示例#3
0
 public void set(List <NodeData> list,
                 Transform tfm,
                 MuscleMotion.Parts parts,
                 MuscleMotion.Parts parent_parts,
                 ulong mask)
 {
     if ((mask & (1UL << (int)parts)) != 0)
     {
         var node_data = new NodeData();
         node_data.set(tfm, parts, parent_parts);
         list.Add(node_data);
     }
 }
示例#4
0
 public bool find(MuscleMotion.Parts parts, out NodeData node_data)
 {
     for (var i = 0; i < node_data_list_.Length; ++i)
     {
         if (node_data_list_[i].node_idx_ == (int)parts)
         {
             node_data = node_data_list_[i];
             return(true);
         }
     }
     node_data = new NodeData();
     return(false);
 }
示例#5
0
 bool update_parts(Transform tfm, string name, MuscleMotion.Parts parts)
 {
     if (tfm.gameObject.name == name)
     {
         var node = muscle_motion_.getNode(parts);
         tfm.transform.position = node.rigidbody_.transform_.position_;
         tfm.transform.rotation = node.rigidbody_.transform_.rotation_ * node.original_rotation_;
         return(true);
     }
     else
     {
         return(false);
     }
 }
        private void collect_transforms_internal(List <TransformNode> transform_node_list,
                                                 Transform parent_tfm, Transform tfm)
        {
            MuscleMotion.Parts parts = MuscleMotionEditorUtil.conv(tfm);
            if (parts == MuscleMotion.Parts.Max)
            {
                return;
            }
            MuscleMotion.Parts parent_parts = MuscleMotionEditorUtil.conv(parent_tfm);
            transform_node_list.Add(new TransformNode(tfm, parent_tfm, parts, parent_parts));

            int num = tfm.childCount;

            for (var i = 0; i < num; ++i)
            {
                var child_tfm = tfm.GetChild(i);
                collect_transforms_internal(transform_node_list, tfm, child_tfm);
            }
        }
示例#7
0
 public void set(Transform tfm, MuscleMotion.Parts parts, MuscleMotion.Parts parent_parts)
 {
     if (parent_parts == MuscleMotion.Parts.Root)
     {
         position_       = tfm.position;
         rotation_       = tfm.rotation;
         local_position_ = tfm.position;
         local_rotation_ = tfm.rotation;
     }
     else
     {
         position_       = tfm.position;
         rotation_       = tfm.rotation;
         local_position_ = tfm.localPosition;
         local_rotation_ = tfm.localRotation;
     }
     node_idx_        = (int)parts;
     parent_node_idx_ = (int)parent_parts;
     name_            = parts.ToString();
 }