Back to the Shapespark home page

How can I track the camera position

Hello how are you? I would like to know how I can track the position of the camera without clicking on an object.
I would also like to be able to control the play action through code. That is, for example, when the camera passes near the object that contains the video texture, it will be played.
Thank you very much!

You can track the camera from your JavaScript code using getCameraPosition() function documented here: https://github.com/shapespark/shapespark-viewer-api

To start a video, you need to first find a material that has a video texture using findMaterial() function (also documented in the same document). Then, you can set isPlaying property of the material to true or false.

1 Like