Jump to content
Search Community

ScrollTrigger/Three.js - animate vector3 issue

Chriz96
Moderator Tag

Go to solution Solved by Chriz96,

Recommended Posts

Posted

I'm animating the camera in a Three.js scene. I'm able to animate the camera position using a timeline, but I also want to animate a vector3 called cameraTarget to control where the camira is looking. However if I log cameraTarget's values it shows that they actually update but in my scene the camera keeps the same cameraTarget view from the beginning, so basically it's not animating the cameraTarget position.

 

This is my camera and cameraTarget setup

 1808082784_Capturadepantalla2022-09-29123357.thumb.jpg.7e8953589ca5f03babd6a418e19166fa.jpg

 

This is my timeline

120833812_Capturadepantalla2022-09-29123431.jpg.402ed42ea1c1037cb7e233a314df1266.jpg

 

And here you can see if I log the cameraTarget values they change as they should, but I don't see the movement in my scene.

205325923_Capturadepantalla2022-09-29123702.thumb.jpg.63ab93c823a5239a4be2df1a4d2bbf4e.jpg

  • Chriz96 changed the title to ScrollTrigger/Three.js - animate vector3 issue
  • Solution
Posted

Well I just had to update camera.lookAt(cameraTarget) by moving it inside my tick function

  • Like 1
Posted

Hi @Chriz96 and welcome to the GreenSock forums!

 

Is great to hear that you were able to solve the issue and thanks for sharing how you did it ?

 

Happy Tweening!

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...