Custom annotations does not stay in correct position

annotations
3d

(Eriol726) #1

Hi, I’m trying to create an application for custom annotations where I used your ‘custom annotation’ example as base. The problem is that when I have rotated / translated the object in Sketchfab’s 3D editor, the annotation points moves to wrong positions, but if I just let the object be untransformed, it works well. Why is that? Do I need to multiply the annotation’s positions with the object’s local or world matrix to get them right? I have tested this but have not managed to get them in the correct position yet.

Thanks in advance.
//Erik


(Paul Sketch) #2

Hi,

I’m not sure I get it. could you please provide more details

  • what “custom annotation” example ? as we have several :slight_smile:
  • you “rotated / translated the object in Sketchfab’s 3D editor” using the orientation widget ? not with javascript code using the sketchfab viewer api ?
  • “tested this” you got result but not those expected ?

Thanks !


(Eriol726) #3

Hi,


(Paul Sketch) #4

Most probably you get some transform hierarchy problems, meaning you specify a “world transform” in the viewer api js calls, but it’s applied on node “local transform”, thus the results not meeting expectations.
Best to make sure the model is totally flat (no more than one transform in the hierarchy above)
So that when you update a transform, “local transform” and “world transform” are the same.


(Eriol726) #5

Today, I just tried to rotate a model a half-turn around the y axis. I used instanceID from the MatrixTransform node and put the y-axis to 1 and enter the values in your rotation function: rotate(instanceID, [Math.PI,0,1,0], {1, easing}, callback).

The model rotated but not around the y-axis, it flew away somewhere else. Why is it like that? Do I have do something special with the models before I can transform them using the sketchfab-api? Like, reset the pivot or transform the model origin before? Or why does the model not rotate as it should?


(Paul Sketch) #6

make sure the model is totally flat, no more than one transform in the hierarchy above a geometry.
Otherwise you’re not transforming the world space, but in a local space
( any scale or rotate before will make things different than what you expect)