lookCamera reset orientation on button click

I am wondering how I can reset the orientation of the camera. I am using the 360 script in the tutorials section of playcanvas. What I would like achieve is this:

I have a UI button. When I click on it a camera animation is being played. But when the camera animation starts playing I would like to have the camera orientation to be reset to its origin.

Any advice on how to do this?

Hi @Maarten_deVries! I think you can store the position and rotation of the camera as a variable in the initialize function and reset the camera to this variables when you need it. But it’s not clear for me what you are trying to achieve because I don’t think you want to do this when you start the animation but when the animation is finished? Or does the camera animation not control the camera itself?

Ok so you can look around with your mouse. But when you click on the UI button you want the camera to reset its orientation to look forward and then the camera animation starts playing.

I think you can do that with the variables, but i’m not sure if it is conflicting with your other script that controls the camera. If you use the script on the camera entity itself you can try for the position something like below.

Initialize function:

this.originalPosition = this.entity.getPosition();

Reset:

this.entity.setPosition(this.orginalPosition);