Hi,
I was modifying the glfw example (for the Go bindings) and modifying some of the joints of the knight.
It happens that when a rotation get close to 90 deg rx and rz got swapped.
Here is the code I'm using to change the transformation:
Code:
if glfw.Key('O') == glfw.KeyPress {
if num := horde3d.FindNodes(knight, "Bip01_Neck", horde3d.NodeTypes_Joint); num != 0 {
head := horde3d.GetNodeFindResult(0)
var tx, ty, tz, rx, ry, rz, sx, sy, sz float32
horde3d.GetNodeTransform(head, &tx, &ty, &tz, &rx, &ry, &rz, &sx, &sy, &sz)
horde3d.SetNodeTransform(head, tx, ty, tz, rx, ry, rz, sx, sy, sz)
}
}
if glfw.Key('P') == glfw.KeyPress {
if num := horde3d.FindNodes(knight, "Bip01_Neck", horde3d.NodeTypes_Joint); num != 0 {
head := horde3d.GetNodeFindResult(0)
var tx, ty, tz, rx, ry, rz, sx, sy, sz float32
horde3d.GetNodeTransform(head, &tx, &ty, &tz, &rx, &ry, &rz, &sx, &sy, &sz)
log.Printf("before: tx %f,ty %f,tz %f,rx %f,ry %f,rz %f,sx %f,sy %f,sz %f\n", tx, ty, tz, rx, ry, rz, sx, sy, sz)
horde3d.SetNodeTransform(head, tx, ty, tz, rx, ry, rz, sx, sy, sz)
log.Printf("after: tx %f,ty %f,tz %f,rx %f,ry %f,rz %f,sx %f,sy %f,sz %f\n", tx, ty, tz, rx, ry, rz, sx, sy, sz)
}
and the logs:
Code:
2013/01/15 15:57:54 before: tx 9.184080,ty 0.000000,tz 0.003139,rx -86.450439,ry 22.060602,rz 0.000028,sx 1.000000,sy 0.999999,sz 0.999999
2013/01/15 15:57:54 after: tx 9.184080,ty 0.000000,tz 0.003139,rx -87.360443,ry 22.060602,rz 0.000028,sx 1.000000,sy 0.999999,sz 0.999999
2013/01/15 15:57:54 before: tx 9.184080,ty 0.000000,tz 0.003139,rx -87.360474,ry 22.060587,rz 0.000037,sx 1.000000,sy 0.999999,sz 0.999999
2013/01/15 15:57:54 after: tx 9.184080,ty 0.000000,tz 0.003139,rx -88.270477,ry 22.060587,rz 0.000037,sx 1.000000,sy 0.999999,sz 0.999999
2013/01/15 15:57:54 before: tx 9.184080,ty 0.000000,tz 0.003139,rx -88.270477,ry 0.000000,rz 22.051538,sx 1.000000,sy 0.999999,sz 0.999999
2013/01/15 15:57:54 after: tx 9.184080,ty 0.000000,tz 0.003139,rx -88.270477,ry 0.000000,rz 22.051538,sx 1.000000,sy 0.999999,sz 0.999999
2013/01/15 15:57:54 before: tx 9.184080,ty 0.000000,tz 0.003139,rx -88.270477,ry 0.000000,rz 22.051538,sx 1.000000,sy 0.999999,sz 0.999999
2013/01/15 15:57:54 after: tx 9.184080,ty 0.000000,tz 0.003139,rx -88.270477,ry 0.000000,rz 22.051538,sx 1.000000,sy 0.999999,sz 0.999999
The rotations swap does't happen again if the "rotation limit" is reached again.
Is this a bug or a known behavior?
As a workaround I'm keeping the rotation in (-87.0, 87.0).