Upload with API and rotation of model

(smixels) #1

I use the API to make upload for 3D models from faces. Here a sample: https://sketchfab.com/models/a5c701fd3b0242da93df8c4c58f74a15
The problem is, that the face is buttom up.
By using “‘orientation’: ‘{“axis”: [0, 1, 0], “angle”: 180}’” during upload the model changes the orientation but is not centered anymore. This is the result: https://sketchfab.com/models/67db9f92d6fd4ff18e11e86517d71cdd

Does anyone can help me?
Thanks in advance.



It’s a known issue and we’re looking for a fix.

(smixels) #4

Hi James,

thanks for the feedback.
Do you have an estimation when it will be fixed? Two weeks, two months?



Hi Patrick,

I hope within a month. It’s been assigned to our developers’ todo list, but we haven’t started work on it yet.

(smixels) #6

Hi James,

do you have an update for me concerning this topic?
Did the developers already started to work on this issue?

Best regards,


Hi Patrick,

Sorry there’s been no update yet. @nehon might have more information.

(Rémy Bouquet) #8

Hello sorry for the delay, this issue was not clear to me and it slipped out.
We can’t “fix” this automatically, the pivot point is the center of the bounding box and we can’t really work that out through the API.

However the patch call can have a matrix passed for the translation

So basically you can fix the translation offset by setting the translation matrix in the call.

For the matrix I recommend you use glmatrix if you have any matrix computation to do.
You can then create a mat4 like this

var mat = mat4.create();
mat[12] = x // translation x component
mat[13] = y // translation y component
mat[14] = z // translation z component

If ever you don’t want to use glmatrix you can create an 16 elements array with identity data and the translation in the 12, 13, 14 elements:

var mat = [1.0, 0.0, 0.0, 0.0, 
           0.0, 1.0, 0.0, 0.0,
           0.0, 0.0, 1.0, 0.0,
           x,   y,   z,   1.0]; 
          |---- tr ----|

Your data in the patch call can then be

 ‘{"matrix":mat, “axis”: [0, 1, 0], “angle”: 180}’

Hope that helps