Knar
March 20, 2021, 8:56am
2
Changing the order of [targetAnimation,radiusAnimation] on line 46 fixes it, I’m not sure why though.
scene.beginDirectAnimation(arcRotateCamera,[targetAnimation,radiusAnimation],0,frameRate * 2,false)
I guess changing targets might stop the other animation for some reason?
1 Like
Knar
March 20, 2021, 8:49pm
4
Whenever the ArcRotateCamera target property is set it runs a function rebuildAnglesAndRadius which overwrites the radius:
* Rebuilds angles (alpha, beta) and radius from the give position and target
*/
public rebuildAnglesAndRadius(): void {
this._position.subtractToRef(this._getTargetPosition(), this._computationVector);
// need to rotate to Y up equivalent if up vector not Axis.Y
if (this._upVector.x !== 0 || this._upVector.y !== 1.0 || this._upVector.z !== 0) {
Vector3.TransformCoordinatesToRef(this._computationVector, this._upToYMatrix, this._computationVector);
}
this.radius = this._computationVector.length();
if (this.radius === 0) {
this.radius = 0.0001; // Just to avoid division by zero
}
// Alpha
const previousAlpha = this.alpha;
if (this._computationVector.x === 0 && this._computationVector.z === 0) {
this.alpha = Math.PI / 2; // avoid division by zero when looking along up axis, and set to acos(0)
} else {
The radius property has no Set function, so the radius changes are overwritten before they have any effect on the camera’s position. I’m not sure if it’s really a bug though.
1 Like