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® FBX® / FBX SDK / World position of a node
  RSS 2.0 ATOM  

World position of a node
Rate this thread
 
48400
 
Permlink of this thread  
avatar
  • Total Posts: 15
  • Joined: 29 September 2010 03:25 PM

Hi everyone!

Suppose I have scene with 2 objects,

grandparent1
|   |---parent1
|         |---child1
|
|
grandparent2
    
|---parent2
          
|---child2

In this scene, child1 and child2 happen to look the same. Now, what do I need to do, to move child1 to where child3 is? If for eg. there was a way to just get and set the world coordinates, I could do that easily. But, all I can do is set the local coordinates?

I would be very grateful if anyone could throw any light on the same!

Thanks a lot in advance,
Kind regards,
Arjun



Replies: 2
/userdata/avatar/vx3501hqr_small.jpg

Where is the child3?

Author: Jiayang Xu

Replied: 17 October 2010 03:35 PM  
/userdata/avatar/vx3501hqr_small.jpg

Also, I think Nian already gave you the answer in this post:  :)
http://area.autodesk.com/forum/autodesk-fbx/fbx-sdk/unlinking-a-node/

Although there is no way to direct set the global transform in FBX, but we can get the global transform by AnimEvaluator. Then we can always get the local transform of a node by: Local = ParentGlobal.Inverse() * Global;
So in you case, if you want to keep the global transform of a node after re-link it, what you need to do is(in pseudo code):
Global = lChild->GetGlobalTransfrom;
Move lChild to somewhere else in the hierarchy (re-link lChild);
NewLocal = NewParentGlobal.Inverse() * Global;
lChild->SetNewLocal;

Author: Jiayang Xu

Replied: 17 October 2010 03:46 PM  
avatar

////////////////////////////////////////////////////////////////////////////
 
fbxDouble3 dstLclTrans;
 
KFbxNode *dstNode findNodeInForest(toAdd[i0].firstcallIdx);
 
KFbxXMatrixdstNodeDefaultGlobalTransform mSceneEvaluator->GetNodeGlobalTransform(dstNode); 
 
dstLclTrans = ((mOrigLclTransOmni[callIdx])[partName]);
 
 
KFbxNode *startNode findNodeInForest(toAdd[i0].firstcallIdx 1);
 
KFbxXMatrixstartNodeDefaultGlobalTransform mSceneEvaluator->GetNodeGlobalTransform(startNode); 
 
 
KFbxXMatrix local dstNodeDefaultGlobalTransform.Inverse()*startNodeDefaultGlobalTransform;
 
fbxDouble3 localT local.GetT();
 
lclTrans[0] -= localT[0];lclTrans[1] -= localT[1];lclTrans[2] -= localT[2];
 
////////////////////////////////////////////////////////////////////////////


Replies: 0