how to generate JavaScript 3D for use in Open Source Physics?
how to generate JavaScript 3D for use in Open Source Physics?
- Install SketchUp http://www.sketchup.com/
- Find the 3D object file required in Open Source Physics say aeroplane
- register to the SketchUp software if necessary and download the model
- save it on the desktop for ease of finding the model
- edit the model so that it is easy to use on the Easy Javascript Modeling tool for example, move the origin to the centre of the plane and aline the direction of the plane to RED x axis
- export the mode in format called OBJ and file name say sia or whatever you want
- now the file is ready, download the python package called https://github.com/lookang/codesforejss/blob/master/webgl_convert/convert/ReadMe.md provided by Felix https://github.com/lookang/codesforejss/blob/master/webgl_convert/convert/ReadMe.md
- save the zip file in the desktop and expand the zip file
- if you need python, install it too https://www.python.org/ , use the latest 3.5.2 version
- copy the file sia.OBJ into the same folder as the convert folder
- open terminal and navigate to the folder , for me was
- \( cd /Users/lookang/Desktop/webgl_convert/convert
- to convert and use the python convert.py file, type in
- \) python2 convert.py sia.obj Object3D_sia.js
- that's it!. insert that just created sia.js file as a 3D object in EJSS in the description
- double click the file sia.js and using an editor like notepad or xcode, add Object3D_ to the var declaration
- save the file and copy it to the ejss folder for use.
- i used "./gimbal/Shuttle.js" , make sure a folder is used to hold all the assets in the Ejss source
- the example can be downloaded here https://sg.iwant2study.org/ospsg/index.php/interactive-resources/mathematics/measurement-and-geometry/geometry/2-3d-shapes/438-glimbal8wee02-1
- to view the output, try this https://iwant2study.org/lookangejss/math/ejss_model_glimbal8wee02/glimbal8wee02_Simulation.xhtml
- https://sg.iwant2study.org/ospsg/index.php/interactive-resources/mathematics/measurement-and-geometry/geometry/2-3d-shapes/438-glimbal8wee02-1 for the example Prof Felix made possible!
Reference:
http://weelookang.blogspot.sg/2016/10/how-to-generate-javascript-3d-for-use.html