Example #1
0
  public Bone(String n, Bone p) {
    name = n;
    parent = p;
    offset = new Transform();
    if (p != null) {
      offset.setParent(p.offset);
    }

    channels = new ArrayList<Channel>();
  }
Example #2
0
 public Transform getOffset(int frame) {
   //		Transform f = new Transform(offset);
   //		if(parent != null) {
   //			return new Vec3(parent.getOffset(frame)).add(f.getPosition());
   //		}
   Transform f = new Transform(offset);
   if (parent != null) f.setParent(parent.getOffset(frame));
   for (int i = 0; i < channels.size(); i++) {
     Channel chan = channels.get(i);
     if (chan.index == Channel.Xposition) {
       f.translate(new Vec3(1, 0, 0), chan.frameValue.get(frame));
       continue;
     }
     if (chan.index == Channel.Yposition) {
       f.translate(new Vec3(0, 1, 0), chan.frameValue.get(frame));
       continue;
     }
     if (chan.index == Channel.Zposition) {
       f.translate(new Vec3(0, 0, 1), chan.frameValue.get(frame));
       continue;
     }
     if (chan.index == Channel.Xrotation) {
       f.rotate(new Vec3(1, 0, 0), chan.frameValue.get(frame));
       continue;
     }
     if (chan.index == Channel.Yrotation) {
       f.rotate(new Vec3(0, 1, 0), chan.frameValue.get(frame));
       continue;
     }
     if (chan.index == Channel.Zrotation) {
       f.rotate(new Vec3(0, 0, 1), chan.frameValue.get(frame));
       continue;
     }
   }
   return f;
 }