Sketchfab Forum

Locking the camera

viewer-api

(Lagrangemtl) #1

Hi,

I'm in the process of creating a product previewer and I wanted to know if it was possible to lock camera rotation, zoom or translation with the viewer API ?

If so how would I go about doing that ?

Thanks !


(Shaderbytes) #2

just cover the viewer iframe with a div , this will block all mouse interaction.


(Lagrangemtl) #3

Thanks for the help, I knew I could do that but what if I wanted to keep the rotation and deactivate the zoom ?


#4

We hope to implement proper camera constraints in the future. I'll add your '+1' to this feature request.

It is sort of possible with the Viewer API, but you would need to poll the camera position continuously. I did a (related) quick and dirty demo here:


#5

You can also use the scrollwheel=0 parameter to block zooming:

https://help.sketchfab.com/hc/en-us/articles/203509907-Share-Models#embed-options


(Lagrangemtl) #6

Thanks a lot, that really helps !


#7

We just launched a Camera Limits feature! I hope it's useful for you.


Cheers,
James