Getting center rotation (pivot) from FBX asset imported
#1
I already loaded a 3d delta robot using assimp importer, the 3d model was defined in 3DS with rotations pivots (local view) and exported to FBX, so, when i load using assimp importer I am getting the model3d parts with a definition that includes the name of the 3dmodel + Assimp__Rotation, giving the opportunity to add rotation transformation and perfor the rotation from the defined pivod in 3ds. What I am not able to find, it is how to  get the center rotation wold coordinates of this pivot. 

Any suggestions?

thanks in advance 
JC
#2
When importing from fbx files the Assimp importer stores the pivot point translation into "ModelName__AssimpFbx__GeometricTranslation" model. This transformation is added before applying the rotation and this way it moves the center of rotation.

See that attached fbx file.

If you open the file in Ab3d.PowerToys sample in the Assimp importer sample and click on the "Show objects info" you will see the following:

Code:
Model3DGroup ("RootNode")   Children count: 4  |  Center: 0 0 0  |  Size: 100 x 73.1 x 9.7 |  Transform: 0.5,0,0,0,0,0.5,0,0,0,0,0.5,0,1.7,7.6,-4.9,1
    GeometryModel3D ("BaseBox")   Material: Group: [ [Diffuse: #FF969696] [Specular: power: 2.00, color: #FF000000, brush: #FFE5E5E5] ] |  Geometry: Positions: 36; TriangleIndices: 36 (12 triangles); Normals: 36; TextureCoordinates: 36  |  Center: -4.9 -25 5.2  |  Size: 211.8 x 10.4 x 10.4 |  Transform: 1,0,0,0,0,1,0,0,0,0,1,0,-4.9,-25,0,1
    Model3DGroup ("RedBox__AssimpFbx__Translation")   Children count: 1  |  Center: -63.4 7.2 9.9  |  Size: 85.5 x 109.5 x 19.8 |  Transform: 1,0,0,0,0,1,0,0,0,0,1,0,-85.8,-19.8,0,1
        Model3DGroup ("RedBox__AssimpFbx__Rotation")   Children count: 1  |  Center: 22.4 27 9.9  |  Size: 85.5 x 109.5 x 19.8 |  Transform: 0.8,-0.6,0,0,0.6,0.8,0,0,0,0,1,0,0,0,0,1
            Model3DGroup ("RedBox__AssimpFbx__GeometricTranslation")   Children count: 1  |  Center: 1.8 35 9.9  |  Size: 10.4 x 128.9 x 19.8 |  Transform: 1,0,0,0,0,1,0,0,0,0,1,0,1.8,35,0,1
                GeometryModel3D ("RedBox")   Material: Group: [ [Diffuse: #FFFF0000] [Specular: power: 2.00, color: #FF000000, brush: #FFE5E5E5] ] |  Geometry: Positions: 36; TriangleIndices: 36 (12 triangles); Normals: 36; TextureCoordinates: 36  |  Center: 0 0 9.9  |  Size: 10.4 x 128.9 x 19.8
    GeometryModel3D ("GreenBox")   Material: Group: [ [Diffuse: #FF00FF00] [Specular: power: 2.00, color: #FF000000, brush: #FFE5E5E5] ] |  Geometry: Positions: 36; TriangleIndices: 36 (12 triangles); Normals: 36; TextureCoordinates: 36  |  Center: -3.5 -29.5 9.7  |  Size: 91.2 x 96.9 x 19.4 |  Transform: 0.7,-0.7,0,0,0.7,0.7,0,0,0,0,1,0,-3.5,-29.5,0,1
    Model3DGroup ("BlueBox__AssimpFbx__Translation")   Children count: 1  |  Center: 57.2 -51.6 10.4  |  Size: 92.8 x 86.4 x 20.8 |  Transform: 1,0,0,0,0,1,0,0,0,0,1,0,82.3,-23.5,0,1
        Model3DGroup ("BlueBox__AssimpFbx__Rotation")   Children count: 1  |  Center: -25.1 -28.1 10.4  |  Size: 92.8 x 86.4 x 20.8 |  Transform: 0.7,-0.7,0,0,0.7,0.7,0,0,0,0,1,0,0,0,0,1
            Model3DGroup ("BlueBox__AssimpFbx__GeometricTranslation")   Children count: 1  |  Center: 3.6 -37.5 10.4  |  Size: 9 x 117.9 x 20.8 |  Transform: 1,0,0,0,0,1,0,0,0,0,1,0,3.6,-37.5,0,1
                GeometryModel3D ("BlueBox")   Material: Group: [ [Diffuse: #FF0012FF] [Specular: power: 2.00, color: #FF000000, brush: #FFE5E5E5] ] |  Geometry: Positions: 36; TriangleIndices: 36 (12 triangles); Normals: 36; TextureCoordinates: 36  |  Center: 0 0 10.4  |  Size: 9 x 117.9 x 20.8

See that RedBox and BlueBox have __AssimpFbx__GeometricTranslation models defined that translate the pivot point - this is defined in OffsetX, OffsetY and OffsetZ in the transformation matrix. The GreenBox does not have that model because the pivot point is not changed for that model (it is rotated around center).

Note that the file was exported by using Z-up axis (if Y-up is used, then there is additional AssimpFbx__PreRotation).


Attached Files
.fbx   moved_pivot_sample_Z-up.FBX (Size: 34.63 KB / Downloads: 0)
Andrej Benedik
  


Forum Jump:


Users browsing this thread:
1 Guest(s)