Translate Api option bug

(Edsahergom) #1

Hi guys,

For some reason the translate option for the api is not taking into account the time that you put it. In other words, it does not matter if I put 2 seconds or 10 seconds, the object translates instantly so 0 seconds. I have tried an old model I had with this feature and it was working perfectly but now it translates as I said.

Can you help me looking at this issue? Thanks.

(Rémy Bouquet) #2

Hello could you please post the code snippet where you call the translate method please?
It's working on our end but the arguments management has been changed recently so there might be a case where there is an issue.

(Edsahergom) #3


Thanks for your reply.

I am using this code:

sketchfabAPIUtility.translate("SHED_AXIS", sketchfabAPIUtility.vectorRight,2500,10);

2500 is the distance and 10 is the time.

(Rémy Bouquet) #4

To my knowledge there is no distance parameter and the third parameter should be the duration in seconds.

See the documentation here

(Rémy Bouquet) #5

Ok I understand now that you are using a third party utility

The code calls the sketchfab API with proper parameters so I'd need more information.
Do you have any error in the console when you call the translate method?

(Edsahergom) #6

Hi, no i don't have any error in the console so no sure what is the problem. As I said before, it was working before but for some reason it stopped working. No sure what the problem is.

(Rémy Bouquet) #7

Do you have a link to the web site so I can check?

(Bart) #8

*summons @shaderbytes*

(Shaderbytes) #9

hey guys, i just checked and is definitely moving instantly time is not factored:

clicking on any Matrixtransform in the drop down will use the current direct and i just hard coded a duration of 2:

  sketchfabAPIUtility.translate(nodeName, directionToUse,1,2);

II have not touched this function since creating it but the duration is not even touched by me, i simply pass it to the api translate function :

 this.translate = function (key, direction,distance, duration, easing, callback) {

        var dataObjectRef = classScope.getNodeObject(key, null, classScope.nodeTypeMatrixtransform);
        var dataObjectRefSingle;
        if (dataObjectRef != null) {
            if (direction == null) {
                direction = classScope.vectorForward;
            if (distance == null) {
                distance = 1;
            if (Array.isArray(dataObjectRef)) {
                console.log("multiple nodes returned during call to lookat, first node will be used");
                dataObjectRefSingle = dataObjectRef[0];
            } else {
                dataObjectRefSingle = dataObjectRef;
            if (dataObjectRefSingle.worldMatrixisCached = undefined) {
                dataObjectRefSingle.worldMatrixisCached = true;
                dataObjectRefSingle.worldMatrixCached = dataObjectRefSingle.worldMatrix;
            var currentPosition = [dataObjectRefSingle.worldMatrix[12], dataObjectRefSingle.worldMatrix[13], dataObjectRefSingle.worldMatrix[14]];
            var newPosition = [currentPosition[0] + (direction[0] * distance), currentPosition[1] + (direction[1] * distance), currentPosition[2] + (direction[2] * distance)];
            //write new position back into matrix
            dataObjectRefSingle.worldMatrix[12] = newPosition[0];
            dataObjectRefSingle.worldMatrix[13] = newPosition[1];
            dataObjectRefSingle.worldMatrix[14] = newPosition[2];
            classScope.api.translate(dataObjectRef.instanceID, newPosition, duration,easing, callback);



(Rémy Bouquet) #10

Thanks, gonna look into this.

(Rémy Bouquet) #11

Ok I can reproduce the issue. It seems an issue on our end on how we manage parameters.
I'm gonna fix it, but in the meantime a workaround is to feed the function with the callback parameter.

sketchfabAPIUtility.translate(nodeName, directionToUse,1,2, undefined, function(){

(Edsahergom) #12


Please let me know how this goes.

(Emilien D) #13


I still have the same problem. Did you fixed it?


(Shaderbytes) #14

@nehon the bug is back , seems you have a case of regression , you can try out this codepen :

No matter what time you set for the movement it always interpolates to the end value instantly.

(ps… the cube move with key arrows, dont click with your mouse on the viewer area or the key strokes will not be picked up by the code , this is an unfortunate result of browser sandboxing with iframes , I have mentioned it on the slack group before )

(Paul Sketch) #15

It seems we had a fail in documentation update, the new arguments are not documented, will fix asap

check translate API samples change since API 1.3

(Emilien D) #16

Thanks for your reply Paul.

It worked fine for me.