on desktop, earth starts zoomed in and zooms out until max distance is reached over 2 seconds (as desired)
on mobile, earths starts zoomed in, zooms out for 2 seconds, does not reach the max distance in that time, and then snaps to the max distance.
It seems like the tween.js update function behaves differently on mobile devices OR the camera distance behaves differently on mobile devices. Any advice on this?
OrbitCamera.prototype.zoomTween = function () {
var self = this;
var start = this.distanceMin;
var dest = this.distanceMax;
var position = this.entity.getPosition();
// create an object to tween its properties
var p = {
from: start,
to: dest
};
var tween = this.app
.tween(p)
.to({from: dest}, this.duration, pc.Linear);
tween.on('update', function() {
var pos = new pc.Vec3(0, 0, p.from);
this.entity.setLocalPosition(pos);
}.bind(this));
tween.on('complete', function () {
self.hasZoomed = true;
self.initializeOrbit();
});
tween.start();
};
With a quick look, the TweenManager gets dt from the engine which has a max dt of 0.1. I can’t see how this would affect it not finishing as the time elapsed is based on that dt.