WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Bone Rotations (https://forum.worldviz.com/showthread.php?t=1615)

sscovil 08-21-2008 01:25 PM

Bone Rotations
 
Hello,

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

Code:

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:
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:
Code:

[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:
Code:

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

Bones transforms_behave_differently_to node3d
 
From .getEuler() and .setEuler(), the viz.ABS_PARENT transform mode works in the PARENT's coordinate system.
But for .getEuler() and .setEuler(), the viz.ABS_PARENT transform mode works in the LOCAL coordinate system.


All times are GMT -7. The time now is 10:35 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC