Hey!
I learnt something new today. That it’s better to use quaternions when animating rotation because it will choose the quickest path to the end position.
At the moment I have been animating my camera using something like this.
public animateAlphaBetaRadius(alphaBetaRadius: Vector3): Promise<Vector3> {
return new Promise(resolve => {
const duration = 60
Animation.CreateAndStartAnimation('camera-alpha', this, 'alpha', 60, duration, this.alpha, alphaBetaRadius.x, 0, this.animationEasing)
Animation.CreateAndStartAnimation('camera-beta', this, 'beta', 60, duration, this.beta, alphaBetaRadius.y, 0, this.animationEasing)
Animation.CreateAndStartAnimation('camera-radius', this, 'radius', 60, duration, this.radius, alphaBetaRadius.z, 0, this.animationEasing, () => { resolve(alphaBetaRadius) }, )
})
}
Where this is a method that is implemented on a custom ArcRotateCamera that inherits from the original.
And I’ve been having troubles with if the user has rotated a couple of spins around the model, the alpha will contain the radians of all the spins too. So now when I animate back to the first spin, the camera will go crazy and animate the spins back.
My question is.
Would it be possible to still take take alpha, beta, radius as a Vector3 parameter, but then convert that
into a quaternion which I then somehow can animate the camera with?
That way I wouldn’t have to run three animations in parallel. And also the rotation would take the shortest route there.
Ps. you can see the problem on this project.
try rotating the camera and then click on one of the icons and it will animate there, but spin like crazy…
https://campusalbano.se/view/all
