# Calculate global rotation of a bone from fbx export data

Can anybody explain to me please, how the global rotation of a bone is calculated ?

In pose mode global and local/pose axis differ. X,Y and Z rotation-values change simultanously, when the joint is rotated over one axis globally. Can be seen, when the view is changed from quaternion-view to xyz-Euler-angle view.

I would like to calculate the global rotation from those data exported with blenders FBX 6.1 ASCII export (for example rotate the ankle_joint 30 degr over the global z-axis). Below is an extract of the exported fbx-file with an animation for the ankle_joint_L rotated around blenders z-axis:

Maybe Lcl Rotation or the posenode matrix can be used ??

            One section with the Lcl Translation, Rotation and Scaling:

...
Model: "Model::ankle_joint_L", "Limb" {
Version: 232
Properties60:  {
Property: "QuaternionInterpolate", "bool", "",0
Property: "Visibility", "Visibility", "A+",1
Property: "Lcl Translation", "Lcl Translation", "A+",0.438361942768097,0.000000032580047,0.000000003539899
Property: "Lcl Rotation", "Lcl Rotation", "A+",-0.000087242375938,65.026167125041809,-0.000069140807423
Property: "Lcl Scaling", "Lcl Scaling", "A+",0.999999940395355,1.000000000000000,0.999999940395355
Property: "RotationOffset", "Vector3D", "",0,0,0
Property: "RotationPivot", "Vector3D", "",0,0,0
Property: "ScalingOffset", "Vector3D", "",0,0,0
...

One section with a fbx-matrix with 4x4 values:
...
Pose: "Pose::BIND_POSES", "BindPose" {
Type: "BindPose"
Version: 100
Properties60:  {
}
NbPoseNodes: 198
...
PoseNode:  {
Node: "Model::ankle_joint_L"
Matrix: 0.000000134451199,-0.579614102840424,0.814895033836365,0.000000000000000,-1.000000000000000,0.000000030697251,0.000000186832239,0.000000000000000,-0.000000133302478,-0.814891040325165,-0.579617083072662,0.000000000000000,0.112832039594650,0.090652249753475,-0.025477036833763,1.000000000000000
}
...

And a section with the animation data:

....
Take: "test_Take" {
FileName: "test_Take.tak"
LocalTime: -1924423249,44261734750
ReferenceTime: -1924423249,44261734750

;Models animation
;----------------------------------------------------

...
Model: "Model::ankle_joint_L" {
Version: 1.1
Channel: "Transform" {
Channel: "T" {
Channel: "X" {
Default: 0.438361942768097
KeyVer: 4005
KeyCount: 1
Key:
1924423250,0.438361942768097,L
Color: 1,0,0
}
Channel: "Y" {
Default: 0.000000032580047
KeyVer: 4005
KeyCount: 1
Key:
1924423250,0.000000032580047,L
Color: 0,1,0
}
Channel: "Z" {
Default: 0.000000003539899
KeyVer: 4005
KeyCount: 1
Key:
1924423250,0.000000003539899,L
Color: 0,0,1
}
LayerType: 1
}
Channel: "R" {
Channel: "X" {
Default: -0.000087242323828
KeyVer: 4005
KeyCount: 25
Key:
0,-0.000087242323828,L,
1924423250,-0.353714926505663,L,
3848846500,-1.422824987255344,L,
...
44261734750,-65.809302954896012,L,
46186158000,-65.948973493233396,L
Color: 1,0,0
}
Channel: "Y" {
Default: 65.026160294852644
KeyVer: 4005
KeyCount: 25
Key:
0,65.026160294852644,L,
1924423250,65.025777804259121,L,
3848846500,65.019978973653792,L,
5773269750,64.994597990698054,L,
...
42337311500,46.019369419756927,L,
44261734750,45.678682999051766,L,
46186158000,45.565769726787863,L
Color: 0,1,0
}
Channel: "Z" {
Default: -0.000069140807423
KeyVer: 4005
KeyCount: 25
Key:
0,-0.000069140807423,L,
1924423250,-0.293096570735064,L,
3848846500,-1.178960660181499,L,
5773269750,-2.662748821038822,L,
...
42337311500,-48.879439417709378,L,
44261734750,-49.101352263842770,L,
46186158000,-49.173642986018081,L
Color: 0,0,1
}
LayerType: 2
}
.....