kovacsv / JSModeler

A JavaScript framework to create and visualize 3D models.
MIT License
654 stars 123 forks source link

Translate a rendered scene left, right, up and down #29

Open udaydutta opened 7 years ago

udaydutta commented 7 years ago

JSModeler might have the API to shift the scene left, right or up down, but I could not find out. I have already looked into the http:/3DViewer.net page. Could you please let me know the API or the key/mouse interaction for that? I am trying to create a generalized viewer page with all sort of interaction capabilities. I do not find any You help is highly appreciated. Thank you.

kovacsv commented 7 years ago

Hello!

I wouldn't transform the scene, I would move only the camera position and up vector. For an example, check the code from 3dviewer.net. Look for the SetNamedView function:

https://github.com/kovacsv/Online3DViewer/blob/master/website/include/importerviewer.js#L133

Hope it helps, Viktor

pavvell commented 5 years ago

@kovacsv thanks for the link, I have the same problem with rotating an object and rotating a camera looks like a right way of doing it using viewer.cameraMove.Set (eye, center, up); But still I can't find right values to make a camera show a profile of my object or rotate an object along Y axis (to display right / left / back / front sides). Are there any guide of how to use eye, center and up in viewer.cameraMove.Set (eye, center, up);?

kovacsv commented 5 years ago

Here is an example on how to do this: https://rawgit.com/kovacsv/JSModeler/development/sandbox/camerapos.html