Camera move on click

I’m trying to get the camera to move when clicking on a button, something similar to sketch fab. I have this tutorial for the hot spots which works well:

https://developer.playcanvas.com/en/tutorials/information-hotspots/

then i want to use the lerp script from here:

https://developer.playcanvas.com/en/tutorials/smooth-camera-movement/

is it possible to get the lerp script to work once the hot spot is selected?

thanks

Hi @jono3d,

You might want to consider using the Playcanvas Tween Library for moving your camera:

https://developer.playcanvas.com/en/tutorials/tweening/

Then you could create your smooth movement by calling the tween events from the button.

2 Likes

Hi @jono3d,

I took a bit of time to throw this project together for you. The code isn’t super clean, but there are plenty of comments to give you an idea of what is happening and how you might want to approach this topic in the future:

Here is the project so you can look at the code:

https://playcanvas.com/project/780327/overview/tween-example

I hope this is helpful

2 Likes

super helpful! thank you so much very kind :slight_smile:

1 Like