Is there a way to fix PlayerCamera height?

hello developer
i want to do about subject
is there a way to fix PlayerCamera height?

just i want to do is
change player camera height without going through the shapespark manipulations [Qkey&Ekey].
for case Example, on arbitrary timing, users touch and click DOMButtons
also how can i measure playerCamera height in meter units …?

Thank you for anything help

The initial camera height is determined by the first view configured in the ‘Views’ tab of the Shapespark editor. If you change the first view configuration, the player will use this height.

You can obtain the current camera position in meters using the Viewer.getCameraPosition() JavaScript API function documented here: GitHub - shapespark/shapespark-viewer-api: JavaScript API for interacting with the Shapespark 3D scene. The z coordinate of this position is the height above the ground for scenes that have ground at 0.

To add a custom button for increasing/decreasing the camera height, you can use Viewer.switchToView JavaScript API function. You can pass a view object as the first argument with position and rotation set to the current camera position and rotation, but z coordinate of the position increased by some offset. Note that unlike the Q and E keys, such buttons will not stop the camera from going thourgh the ceiling or floor if the user changes the height too much.

Thank you everthing ! ill try that

hi
i tryed as you showed
if worked
but, it regard as a camera point ,so all of object visible flags are initialized …
i have not a server . i could not reffer from image url Material from server
how can i resolve this? thank for your kindness…

I’m sorry, I didn’t think about this problem when proposing the solution. If you have a scene when you hide objects per view, using switchToView functionality to change the camera height will be problematic, because you will be also changing objects visibility.

1 Like

Thank you for rep

does it exist API can change object Visibility?