AnsweredAssumed Answered

JS SceneView: scene animation is undetermined when update camera

Question asked by stuneo on Dec 28, 2019
Latest reply on Jan 16, 2020 by stuneo

Hello there,

 

I am developing a Javascript app using ArcGIS Online JSAPI 4.13 on latest version of Chrome browser. I have a polyline drawn on 3D scene view, i would animate the view around the line in bird eyes view mode. I have done it with view.goTo(target, options) easily but debugging on Chrome showing some render performance issues that fps gets very low. So I switched to try out to control the camera manually, I see the FPS got better if in case I don't reset the view center at every requestAnimationFrame loop but in such situation the animation gone undetermined, if I do reset the view center to target point the view animated as expected. See my code snippet below.

 

I have 3 questions would like to ask:

1. Is this true the view.goTo(target, options) will slow down render FPS in comparison with props.view.camera manually update?

2. Why reset view center at every animation frame causing FPS dropped?  and this leads to the third question

3. Why do I need to update the view center at every animation loop in order to get animated view as expected, isn't camera's heading, tilt, position update enough to calculate view perspective?

 

Any hint would be much appreciated, I got stuck on this few days  

 

Thanks

Yen

 

// 1. Update the camera at each requestAnimationFrame
let camera = props.view.camera.clone();
camera.heading = heading;
camera.tilt = tilt;
camera.position = position;
view.camera = camera;
// 2. if I do update the view like this, the animation will run as expected but the FPS got very low
var center = props.view.center.clone();
center.longitude += position.longitude - center.longitude;
center.latitude += position.latitude - center.latitude;
view.center = center;
 

Outcomes