Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® MotionBuilder® / Python / How to get 3D position of a model object
  RSS 2.0 ATOM  

How to get 3D position of a model object
Rate this thread
 
22366
 
Permlink of this thread  
avatar
  • gosha1128
  • Posted: 05 February 2009 05:54 AM
  • Total Posts: 18
  • Joined: 30 January 2009 07:05 AM

Hi,

I have an actor with some mocap data applied in an animation sequence (FBX,C3D).

I would like to step through each frame of the animation, get the 3d position of some joints, and output the values to a file.

I pretty much have everything done, except getting the 3d position of the joints at each step. 

At each step in the animation, i get the joint’s model object, and use GetVector() - but that appears to be returning the same value for each step.  I can clearly see that the particular joint is moving when I play the animation.

Can anyone tell me what I might be doing wrong (other than being a bonehead) ?  O

Thanx!



Replies: 0
avatar
  • Avalon
  • Posted: 05 February 2009 12:25 PM

Hi!
This is due to MB realtime engine. Either you need to plot the animation to the joint or run a scene evaluation on each frame!

FBSystem().Scene.Evaluate()
Cheers,
Chris



Choose a job you love, and you will never have to work a day in your life.

Replies: 0
avatar
  • k_thod
  • Posted: 05 February 2009 12:28 PM

Hello..From what i understand you’re trying to get the ‘’Global’’ position of each bones ...
I think i don’t make any mistake by saying that ‘’Getvector’’ return a Local position without the boolean value to ask Global
So in the case of a skeleton you won’t have any Local position animation (except the hips) ...

try something like this ?

for mod in lModels:
GT = FBVector3d()
mod.GetVector(GT, FBModelTransformationMatrix.kModelTranslation, True)

K_thod

Edit : forget this..the evaluate thing should do the trick...sorry



Replies: 0
avatar
  • gosha1128
  • Posted: 05 February 2009 03:33 PM

OK, thanx.

So GetVector() should return the global coordinates by default, is what you are saying.  That makes total sense.

Now, I do call Evaluate() in my python “for” loop, so it must be something else. 

BTW, is it possible to have each iteration of the loop also update the MOBU user interface somehow?  It locks up until the for loop is done. 

Thanx!

-George



Replies: 0
avatar
  • hansen.ck
  • Posted: 25 February 2009 06:11 PM

Quick question… are you using the global position??  cause i just wanted to point out that usually the root joint only has position data and all others positions are driven by rotation.. something to think about.



Replies: 0