The scene is not showing anything


(Sheds4 U) #1

Hi,

Yesterday I tried to open a model using the API and I am not receiving any imaging. I am not sure if this is related to the updated version of the API. This model was working perfectly and suddenly this happened.

Could you please help me out? I have attached some screenshots.



(Stephomi) #2

Can you paste the url of your page?


(Sheds4 U) #3

Many thanks https://buildit.sheds4u.co.nz/?model=1&v=2&t=see


(Sheds4 U) #4

It seems the problem comes form this script which is in sketchfab domain https://static.sketchfab.com/static/builds/web/dist/embed-7f0bc86c10f45f95d845.js


(Stephomi) #5

Indeed there’s a regression with our setCameraLookAt function, we’ll fix it quickly, sorry for the inconvenience!


(Sheds4 U) #6

Is that because of the new update of the API? I remember I opened these models 3 days ago and they were working. Just wondering if that is the reason.

Many thanks!!


(Sheds4 U) #7

Hi, is there any update?


(Stephomi) #8

Fix is ready and needs to be deployed.
Unfortunately it’ll probably happen next week (monday normally).

Until then, you can provide a “duration” value when calling lookAt/setCameraLookAt, (the default value is 2.0).
Normally the attribute is optional but we introduced a bug.


(Sheds4 U) #10

Thanks, I am trying to put a duration in all the functions by using

if (duration == null) {
distance = 3.0;
}

but the bug is still there. This is the entire function:

this.lookat = function (key, direction, distance, duration, callback) {
var dataObjectRef = classScope.getNodeObject(key);
var dataObjectRefSingle;
if (dataObjectRef != null) {
if (direction == null) {
direction = classScope.vectorForward;
}
if (distance == null) {
distance = 10;
}
if (duration == null) {
distance = 3.0;
}
if (Array.isArray(dataObjectRef)) {
console.log(“multiple nodes returned during call to lookat, first node will be used”);
dataObjectRefSingle = dataObjectRef[0];
} else {
dataObjectRefSingle = dataObjectRef;
}

  var target = [dataObjectRefSingle.worldMatrix[12], dataObjectRefSingle.worldMatrix[13], dataObjectRefSingle.worldMatrix[14]];
  var eye = [target[0] + (direction[0] * distance), target[1] + (direction[1] * distance), target[2] + (direction[2] * distance)];
  classScope.api.setCameraLookAt(eye, target, duration, callback);

}

}


(Stephomi) #11

The fix has been release and looks like the exemple is working now.

ps: you should compare against undefined, not null (if duration is not provided).
But with the fix is released you don’t have to change your code now.


(Sheds4 U) #12

Many thanks!!

I am still getting some similar problems with this model https://buildit.sheds4u.co.nz/?model=130&v=0&t=end


(Sheds4 U) #13

Hi, just wondering if you could check the last link I sent.

Many thanks.


(Paul Sketch) #14

yes, Looking into it.
Meanwhile, perhaps reverting to “1.1” sketchfab api viewer version might fix it? it fixes at least the load with 1.1.


(Paul Sketch) #15

The “lookat” wrapper function you’re using just doesn’t support variable arguments list.
you need either:

  • to use directly the lookat of sketchfab-viewer.js
  • provide all params (filling with undefined,undefined like lookat(myKey, myDirection, undefined, undefined, myCallback); works)
  • Add handling of varargs, for instance
...
var distance, duration, callback;
if (arguments.length === 3){
    distance = 100;
    duration = 3.0;
   callback = arguments[2];
}else if (arguments === 4)
   duration = 3.0
   callback = arguments[3];
}
...

(Sheds4 U) #16

Thank you very much Paul