PDA

View Full Version : Bone Rotations


sscovil
08-21-2008, 01:25 PM
Hello,

When I run the following code, I don't get 0,0,0 output as I expect.

male = viz.add('vcc_male.cfg')
male.setEuler([0,0,0])
male.setPosition([0,0,0])
male_pelvis = male.getBone('Bip01 Pelvis')
male_pelvis.lock()
male_pelvis.setEuler([0,0,0],viz.ABS_PARENT)
male_pelvis.setEuler([0,0,0],viz.ABS_GLOBAL)

print male_pelvis.getName()
print male_pelvis.getEuler(viz.ABS_PARENT)
print male_pelvis.getEuler(viz.ABS_GLOBAL)
print '\n'

Even if I add a 'male_pelvis.setEuler([0,0,0],viz.AVATAR_WORLD)' to it, it gives different numbers but still not 0,0,0. I'm thinking I don't understand how it works. Can you explain to me how the different 'rotation spaces' work, and why this isn't outputting 0,0,0?

Thanks,

Stephen

farshizzo
08-22-2008, 10:24 AM
I ran the following code:male_pelvis.setEuler([0,0,0],viz.ABS_PARENT)
print male_pelvis.getEuler(viz.ABS_PARENT)

male_pelvis.setEuler([0,0,0],viz.ABS_GLOBAL)
print male_pelvis.getEuler(viz.ABS_GLOBAL)

male_pelvis.setEuler([0,0,0],viz.AVATAR_WORLD)
print male_pelvis.getEuler(viz.AVATAR_WORLD)And got the following output:[0.0, 0.0, 0.0]
[-3.4150864394177916e-006, 0.0, 0.0]
[-2.4426660780868525e-012, 6.5951979988376763e-011, 0.0]All those values are equivalent to [0,0,0], so I'm not sure what exactly the problem is.

sscovil
08-25-2008, 06:39 AM
Ok, I think I kinda see. So each bone has a few different rotations that are combined? Like, it has its own, then gets rotated by the avatar world rotation? Since without the WORLD one, the code I originally posted gave me this:

[90.0, 8.8792461610864848e-005, -90.0]
[-3.4150864394177916e-006, 0.0, 0.0]

Even though I set the GLOBAL to 0,0,0. How come?

farshizzo
08-25-2008, 06:04 PM
No, each bone has a single position/rotation. The different mode options simply specify in which coordinate frame you want to set the value of the bone. In your code the line:male_pelvis.setEuler([0,0,0],viz.ABS_PARENT) does nothing because you change the bone rotation in next line using viz.ABS_GLOBAL mode. The 2 values are different because viz.ABS_PARENT is getting the bone rotation in the parent bones coordinate frame and viz.ABS_GLOBAL is getting the rotation in the global coordinate system (which accounts for parent bone and avatar rotation)

sscovil
08-27-2008, 10:23 AM
Ok, that's what I needed to know. Thanks!

S_L_A__IKP_23o
05-19-2016, 04:07 AM
From <node3d>.getEuler() (http://docs.worldviz.com/vizard/commands/node3d/getEuler.htm) and <node3d>.setEuler() (http://docs.worldviz.com/vizard/commands/node3d/setEuler.htm), the viz.ABS_PARENT transform mode works in the PARENT's coordinate system.
But for <bone>.getEuler() (http://docs.worldviz.com/vizard/commands/bone/getEuler.htm) and <bone>.setEuler() (http://docs.worldviz.com/vizard/commands/bone/setEuler.htm), the viz.ABS_PARENT transform mode works in the LOCAL coordinate system.