//binds the objects in the object hierarchy to a pose, either current or base void setPose(bool boundToCurrent) { for (int jointID = 0; jointID < animData.poseBase.Length; jointID++) { animationTransformData tData = new animationTransformData(0); if (boundToCurrent) { KeyFrame currentKey = animData.poseBase[jointID].keyFrames[currentKeyFrame]; tData.setTransformIndividual(currentKey.keyPosition, currentKey.keyQRotation, currentKey.scale); } ForwardKinematics.setData(gameObjectHierarchy, animData, tData, jointID); } }
// Update is called once per frame void Update() { int jointCount = animationObjectHierData.ObjectHierarchy.Count; currentKeyFrame++; if (currentKeyFrame > maxFrame) { currentKeyFrame = 0; } blendPoseData poseDataResult = blendTreeData.useBlendTree(blendTreeData, currentKeyFrame); for (int i = 0; i < jointCount; i++) { ForwardKinematics.setData(animationObjectHierData, animData, poseDataResult.getPoseData(i), i); } }