use of io.xol.chunkstories.api.animation.SkeletalAnimation.SkeletonBone in project chunkstories-api by Hugobros3.
the class CompoundAnimationHelper method getBoneHierarchyTransformationMatrixInternal.
private final Matrix4fc getBoneHierarchyTransformationMatrixInternal(String boneName, double animationTime) {
SkeletalAnimation animation = getAnimationPlayingForBone(boneName, animationTime);
SkeletonBone bone = animation.getBone(boneName);
// Out if null
if (bone == null) {
System.out.println("null bone");
return new Matrix4f();
}
// Get this very bone transformation matrix
Matrix4fc thisBoneMatrix = getBoneTransformationMatrix(boneName, animationTime);
// Transform by parent if existant
SkeletonBone parent = animation.getBone(boneName).getParent();
if (parent != null) {
Matrix4f thisBoneMatrix2 = new Matrix4f();
getBoneHierarchyTransformationMatrixInternal(parent.getName(), animationTime).mul(thisBoneMatrix, thisBoneMatrix2);
return thisBoneMatrix2;
}
return thisBoneMatrix;
}
Aggregations