x3dom / x3dom

X3DOM. A framework for integrating and manipulating X3D scenes as HTML5/DOM elements.
http://x3dom.org
Other
813 stars 271 forks source link

Camera Rotation Limit #1233

Open saalem-git opened 1 year ago

saalem-git commented 1 year ago

Hi, It's been a few days since I am exploring x3dom which looks really cool library for the 3D. I wonder how can we limit the camera rotation to only left and right (when we rotate left and right)? The issue in this link https://360vt.my/x3dom/

Possible to get the camera like this example? https://sketchfab.com/3d-models/one-thousand-museum-8c75e29b301d46498d19e6cee780832f

I read the documentation and there is Navigation that is used for the camera control. We can use attributes type = (Examine, Walk, Fly, Helicopter, Look at, and Turntable) but none of them work out.

microaaron commented 1 year ago

Try game mode please. https://doc.x3dom.org/tutorials/animationInteraction/navigation/index.html https://doc.x3dom.org/tutorials/animationInteraction/navigation/example.html

saalem-git commented 1 year ago

@microaaron, Thanks for the reply. I tried the game mode also but it does not work. Firstly, the camera movement is the same as before, and in game mode, the model moves when the cursor moves too.

microaaron commented 1 year ago

Maybe you need to capture keyboard and mouse events and calculate the position and orientation of the Viewpoint by yourself. https://doc.x3dom.org/tutorials/animationInteraction/viewpoint/index.html

andreasplesch commented 1 year ago

If you are willing to use a newer version than 1.5.0, you could try turntable mode (press "n"). This mode would be closest to the sketchfab camera. https://doc.x3dom.org/tutorials/basics/hello/HelloX3DOM.html, press "n".