js with jit.anim.node
Hi all,
I'm very new to using javascript in max so please excuse my naivety. My aim is to write a js file that will create a jit.anim.node object for each "bone" in the 3d model so that I can get their positions and then fill a matrix with those values. I'd love if someone could point me in the right direction. Am I way off with my js file?
Thanks in advance, attaching patch and js
you may be interested in the copynodestoclipboard message to jit.gl.model. From the ref-page:
Copy all nodes in the model as jit.anim.node objects, to the clipboard. When the nodes are pasted in the patch, they will control the internal nodes of the model. Make sure the name attribute is set before using this feature.
if you'd prefer to manage in JS, it's pretty straight forward to build an object-array of jit.anim.node objects:
var mymodel = new JitterObject("jit.gl.model");
var mynodenames;
var myanodes = new Object();
function init_model(){
mynodenames = mymodel.getbonenames();
for (var n in mynodenames) {
var node = new JitterObject("jit.anim.node");
node.name = mynodenames[n];
myanodes[node.name] = node;
}
}
How could I then get the position of each node? When I try pass node to the bang() function it gives me an error? If I use the .getparentpos message in the init_model() function then it comes back as 0 because it creates a new array each time