Iframe sending data


We iframe the scene. Our website sending x,y,z, pitch, yaw every .5 seconds to the scene and set view using viewer.switchToView(). But if we set the data every .5 seconds or 500 millisecond the scene move slow almost not moving. If we set the interval every 3 seconds it move normal but delay. We need to sync data at the same time because we use every scene for education. Students see delay on scene. How can we fix that?


Why no one answer my question? Because I’m not subscriber? We have another account with subscription with 100+ scene. Also I send messages to support but they’re not responding. Why?

By default the switchToView operation may take up to a few seconds. If you want to make it shorter please use the maxTime argument described at https://github.com/shapespark/shapespark-viewer-api#view-switch.

Yes we try this set to 0 and send data to scene every 50 - 100 milliseconds but it gives laggy or not smooth movements. Any solution for that?

If you need to maintain smooth camera movement and no lag, you might consider updating the position more often on the receiver’s end by extrapolating the current position from the last few received positions.

what do you mean? Do you have example or api? Documentation for that?

This is not a part of the API. If the recipient receives camera updates less frequent than it renders frames, there camera changes will likely look jumpy. To avoid that you can try extrapolating the current camera position for each rendered frame.

In it’s simplest form you could use a linear function, say, if the last received position P_1 refers to time t_1, and the preceding position P_0 refers to time t_0, the position at the current moment t can be extrapolated as P_1 + (P_1 - P_0) * (t - t_1) / (t_1 - t_0).