I’m hoping to get some help with gsap animations around a scene.
I know we are not supposed to ask multiple questions in one post, but I think fixing one of my issues will fix everything. So, please forgive me for asking so much.
I put together a quick scene with a few spheres, along with buttons that animate the cameras movement to the spheres. There is also a scene reset button in the dat.gui that puts the scene back to its original position. The example is here
The problem is this,
Right now when a button is clicked the camera “fly’s” to the sphere’s exact position. But I would like to have the camera move to a position where it stops in front of the sphere so that it is directly in the cameras view as opposed to the camera being inside the sphere. There should be some distance between the camera and the sphere… Hopefully that makes sense.
If one button is pressed, the controls.target function, and the camera.position both work correctly the first time. When the camera stops moving, the scene jumps, and the orbit control stop working all together. But if another button is pressed, the camera will move to the corresponding ball, but the controls.target function animation does not work.
If the scene reset button is pressed, that animation works fine, and when it finishes the orbit controls work again.
Right now the camera, and controls.target position are the same XYZ positions. If one change is made to the target position everything works fine. For instance, ball 1 position is:
x: -17.6, y: -1, z: 28.9.
If one digit is changed in the controls.target animation the orbit controls don’t freeze up.