I believe i found some bug but not sure :
* the worldpos message sent to jit.anim.node (the outside binded to internal model's nodes) retrieve local position, is it normal?
* to load the model and get the joints. I must :
- read a file and put into the gl.model
- trig my initModel() function -> retrieve no nodes found.
- trig a second time my initModel() function -> retrieves nodes OK, found nn nodes.
is it because the context must render the model and we must wait one frame before retrieving nodes?
here is the js code :
var mynodenames;
var mroot = new JitterObject("jit.anim.node");
var mymodel = new JitterObject("jit.gl.model");
var myjitanimnodes = new Array();
function read (filename){
mymodel.read(filename);
}
function initModel(){
mymodel.drawto = "doll-ctx";
mymodel.smooth_shading = 1;
mymodel.lighting_enable = 1;
mymodel.position = [0.,-1.,-0.5];
mymodel.scale = [0.01,0.01,0.01];
mymodel.nodesaxes = 1;
mymodel.axes = 1;
mymodel.poly_mode = [1,1];
mymodel.drawskeleton = 1;
mymodel.normalize = 0;
mynodenames = mymodel.getnodenames();
post ("Model length : " + mynodenames.length);
for (var n in mynodenames) {
var node = new JitterObject("jit.anim.node");
var bindargs = new Array();
node.name = mynodenames[n]+"bind";
node.anim = mroot.name;
bindargs.push(mynodenames[n]);
bindargs.push(node.name);
mymodel.nodebind(bindargs);
myjitanimnodes.push(node);
}
}
function getModelInfo(){
for (n in myjitanimnodes){
myjitanimnodes[n].update_node();
post("node name and local position (worldpos seems to not work) : " + myjitanimnodes[n].name + " "+ myjitanimnodes[n].worldpos + "n");
// this post() retrieve local position, not global, is it normal?
}
}
Regards
Pierre