WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 11-17-2010, 07:51 AM
awstorer awstorer is offline
Member
 
Join Date: Nov 2010
Posts: 1
Scaling Avatars and Setting Bone Positions

Hello there!

I am trying to set the absolute position of individual bones in my avatar, but am getting mysterious results depending on whether I've scaled the avatar first.

I determine the parameter sc to be the degree of scaling, and then apply:


mySubject = viz.add('./resources/object/vcc_male.cfg')
mySubject.setScale([sc,sc,sc])


The problems occur when I set the position of a specific bone.

armForeBone = mySubject.getBone('Bip01 R Forearm')
armForeBone.lock()
...
armForeBone.setPosition([10,20,10],viz.ABS_GLOBAL)
print "[10,20,10] Arm Position:",armForeBone.getPosition(viz.ABS_GLOBAL)
armForeBone.setPosition([0,0,0],viz.ABS_GLOBAL)
print "[0,0,0] Arm Position:",armForeBone.getPosition(viz.ABS_GLOBAL)


My hunch is that because I am retrieving the position in global coordinates, and then setting it in global coordinates, I should print out the following:

Quote:
[10,20,10] Arm Position: [10,20,10]
[0,0,0] Arm Position: [0,0,0]
Prior to scaling, I get the following:

Quote:
[10,20,10] Arm Position: [10.0, 20.000001907348633, 10.000000953674316]
[0,0,0] Arm Position: [1.4901161193847656e-008, -1.1920928955078125e-007, 7.4505805969238281e-009]
While I'm a little mystified as to why there is a rounding error, it really doesn't make much difference to me. What is troubling is that after I scale, I get the following:

Quote:
[10,20,10] Arm Position: [7.8901848793029785, 15.965287208557129, 7.8532319068908691]
[0,0,0] Arm Position: [0.031053377315402031, 0.24702535569667816, -0.0058987573720514774]
This is not the position I set! How can I set an exact position after applying a scaling?

Thanks very much for any assistance, and I hope I've provided enough information!

~Alex
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 07:16 PM.


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