Hi everyone, I just made this account to post this!
We had found that on desktop and most mobile devices our game was working fine. Basically it is a flight simulator, with a camera following the plane in 3rd person.
However on some particular devices (older Huawei phones, for instance) the camera would completely spaz out and fly all around the map at the speed of light. When we console logged the camera position it was indeed the thing moving, and not the plane, which was standing still.
Some quick background - our camera system basically tells the camera to move towards the plane every frame (to a particular transform just near the plane, for a good 3rd person perspective). This movement involves calculating a lerp from wherever the camera is, to this 3rd person position and is called in each Update() call from the plane controller script.
The problem:
We were passing deltaTime from the planeController script to the cameraController script, and calculating the lerp as such:
this.targetLerpMoveValue = new pc.Vec3().lerp(this.startLerpPos, this.endLerpPos, this.lerpSpeed * deltaTime);
this.entity.setPosition(this.targetLerpMoveValue);
The solution:
We had to get rid of delta time and just pass a hard-coded value (in our case, 0.016, for 60FPS) as such:
this.targetLerpMoveValue = new pc.Vec3().lerp(this.startLerpPos, this.endLerpPos, this.lerpSpeed * 0.016);
this.entity.setPosition(this.targetLerpMoveValue);
Now on those older/niche phones, it works!
When we console logged the delta time, out of curiosity, it would change very rapidly from 0.03 to 0.1 to 0.04 to 0.08, so who knows what’s going on on those phones…?