100 likes | 249 Views
Overall Flow Diagram. Interpolator Problem. Main.wrl- (Integration done!). DEF buttons Group {} DEF containers Group{} DEF scripts Group{}. Main.wrl- (Integration done!). DEF buttons Group { #Button to load skeleton #Button to load skin #Button to load skin #Button to load animation
E N D
Main.wrl-(Integration done!) DEF buttons Group {} DEF containers Group{} DEF scripts Group{}
Main.wrl-(Integration done!) DEF buttons Group { #Button to load skeleton #Button to load skin #Button to load skin #Button to load animation #Button to animate } ROUTE LoadSkeletonButton.isActive TO loadSkeleton.start ROUTE LoadSkinButton.isActive TO loadSkin.start ROUTE AttachWeightsButton.isActive TO assignWeights.start ROUTE LoadInterpolatorsButton.isActiveTO loadInterpolators.start ROUTE AnimateButton.isActive TO ENGINE.start
Main.wrl-(Integration done!) DEF containers Group { DEF importedSkeleton Group{} DEF importedSkin Group{} DEF importedInterpolators Group{} } ROUTE importedSkeleton.children_changed TO putInHumanoid.start ROUTE importedSkin.children_changed TO putInHumanoid.skinCalled ROUTE importedInterpolators.children_changed TO loadInterpolators.routeTimerToInterpolators
Main.wrl-(Integration done!) DEF scripts Group { #loadSkeleton #loadSkin #putInHumanoid #assignWeights #loadInterpolators #animate } ROUTE LoadSkeletonButton.isActive TO loadSkeleton.start ROUTE LoadSkinButton.isActive TO loadSkin.start ROUTE AttachWeightsButton.isActive TO assignWeights.start ROUTE LoadInterpolatorsButton.isActive TO loadInterpolators.start ROUTE AnimateButton.isActive TO ENGINE.start
Main.wrl-(Integration done!) DEF putSkeletonInHumanoid Script { eventIn MFNode start eventIn MFNode skinCalled directOutput TRUE field SFNode humanoid NULL url "javascript: function start(value) { humanoid=value[1]; print('in first'+humanoid); } function skinCalled(value) { //print(value[0]+','+value[1]); humanoid.humanoidSkin=value[1]; humanoid.skinCoord=value[0]; } " }
Main.wrl-(Integration done!) DEF assignWeights Script { directOutput TRUE field SFFloat threshold 8.5 field SFNode humanoid USE HUMANOID #field SFNode mcSkin USE mocapSkin field MFVec3f coordList [] field SFNode joint NULL field MFNode jointList [] field SFInt32 count 0 url "javascript: function initialize() { coordList = humanoid.skinCoord.point; jointList=humanoid.joints; if(count==0) AssignVertices(); } function AssignVertices() { count++; var iNumJoints = humanoid.joints.length; for (j=0; (j<iNumJoints) ; j++) { var currentJoint = jointList[j]; joint=currentJoint; //Go through all vertices in skin (mocapSkin) for(v=0;v<coordList.length;v++) { var currentVertex=coordList[v]; //calculate distance between current vertes to joint var distance=Math.sqrt((currentJoint.translation[0]-currentVertex[0])*(currentJoint.translation[0]-currentVertex[0])+ (currentJoint.translation[1]-currentVertex[1])*(currentJoint.translation[1]-currentVertex[1])+ (currentJoint.translation[2]-currentVertex[2])*(currentJoint.translation[2]-currentVertex[2])); //if distance within threshold if(distance<threshold) { //add vertex to affectedVertices of the joint joint.affectedVertices[joint.affectedVertices.length]=v; //based on the distance calculate weight of this vertex and add that to weights filed of the joint var weight; //needs a more logical strategy weight=(threshold-distance)/1000*threshold; joint.vertexWeights[joint.vertexWeights.length]=weight; } } } } " }
Main.wrl-(Integration done!) DEF loadInterpolators Script { directOutput TRUE eventIn SFBool start eventIn MFNode routeTimerToInterpolators field MFString address ["boxman-interpolatorGroup.wrl"] field SFNode node USE importedInterpolators field SFString event "addChildren" field SFNode fromNode USE TIMER field SFNode toNode NULL field SFString fromEventOut "fraction_changed" field SFString toEventIn "set_fraction" field SFNode jtoNode NULL field SFString jfromEventOut "value_changed" field SFString jtoEventInt "set_translation" field SFString jtoEventInr "set_rotation" field SFNode humanoidContainer USE importedSkeleton field SFNode humanoid NULL field SFNode engineNode USE ENGINE field SFNode fn NULL field SFString ffe "rotation_changed" field SFString fte "update" url "javascript: function start(clicked) { //Bring in teh interpolators if(clicked) { print('loading interpolators'); Browser.createVrmlFromURL(address, node, event); } }
Main.wrl-(Integration done!) function routeTimerToInterpolators(groupOfInterpolators) { print('animation routing'); humanoid=humanoidContainer.children[1]; var interCount=groupOfInterpolators[0].children.length; //print(interCount); for(i=0;i<interCount;i++) { toEventIn=groupOfInterpolators[0].children[i]; Browser.addRoute(fromNode, fromEventOut, toNode, toEventIn); //routeInterpolatorsToJoints(); if(i==0) { Browser.addRoute(toNode,jfromEventOut,jtoNode,jtoEventInt) jtoNode=humanoid.joints[interCount-2]; } else{ jtoNode=humanoid.joints[interCount-2-(i-1)]; Browser.addRoute(toNode,jfromEventOut,jtoNode,jtoEventInr) } print(i+ toEventIn+jtoNode); } //someone!! fn=humanoid.joints[interCount-i]; print('fn'+fn); Browser.addRoute(fn, ffe, engineNode, fte); } " }