GMU:Tutorials/Networking/Controlling Processing with The Captury: Difference between revisions

From Medien Wiki
No edit summary
No edit summary
Line 38: Line 38:
</source>
</source>
<br>
<br>
*To receive a value from the Captury, it's necessary to inform Processing the name of the skeleton and the bone.  
*Inform Processing the name of the skeleton and the bone in use.  
<source lang="Java" line start= "25">
<source lang="Java" line start= "25">
String skeleton1 = "LiQianqian";  //Skeleton name same with the Captury
String skeleton1 = "LiQianqian";  //Skeleton name same with the Captury
String bone1 = "Root";  //The bone you want to track
String bone1 = "Root";  //The bone in use
</source>
</source>
<br>
<br>
*To make sure all the bones you want to track always can be called确保更新
*To make sure that all the bone in use can be refreshed every second or so.
<source lang="Java" line start= "53">
<source lang="Java" line start= "53">
refreshSubscriptions();
refreshSubscriptions();
Line 58: Line 58:
}
}
</source>
</source>
*plug a specific bone
<source lang="Java" line start= "103">
<source lang="Java" line start= "88">
void subscribeBone(String skeletonId, String bone) {
void plugBone(Object target, String skeleton, String bone) {
   OscMessage msg = new OscMessage("/subscribe/" + skeletonId + "/blender/" + bone + "/vector");
   String path = "/" + skeleton + "/blender/" + bone + "/vector";
  msg.add(50.0);
   osc.plug(target, "update" + bone, path);
  msg.add(0.0);
  msg.add(100.0);
   osc.send(msg, remote);
}
}
</source>
</source>
*capture all OSC events
*capture all OSC events
<source lang="Java" line start= "78">
<source lang="Java" line start= "78">
Line 73: Line 76:
     println(" typetag: "+msg.typetag());
     println(" typetag: "+msg.typetag());
   }
   }
}
</source>
*plug a specific bone
<source lang="Java" line start= "88">
void plugBone(Object target, String skeleton, String bone) {
  String path =  "/" + skeleton + "/blender/" + bone + "/vector";
  osc.plug(target, "update" + bone, path);
}
}
</source>
</source>