Axis reorientation in three .js fails when web page is refreshed

I am working on a project using the source code of the three.js editor, which can be downloaded from the three.js website. As part of the project, I need to reorient the axes so that they can be aligned with the standard coordinate axes used for aircraft (x axis from the nose, y axis from the left wing, z axis down). The orientation that I am describing can be seen by clicking on the link below: orientation of the design axis

To get this, I changed index.html (in the editor folder), three.js files (in the build folder), Editor.js files (editor / js). After my modifications in detail below , I can make the axes rotate correctly, but when I refresh / reload the page, it breaks and no longer needs the orientation that I need more. However, when I click File> Create, it is reset and that’s how I need it. Does anyone know why the code doesn't work when I reload the page?

Here are the changes I made to the code:

index.html (line 12):

<script src="../build/three.js"></script>

of

<script src="../build/three.min.js"></script>

this allows me to use the three.js file instead of the min.js file

three.js (lines 40581 and 40582):

vertices.push( - size, k, 0, size, k, 0 );
vertices.push( k, - size, 0, k, size, 0 );

from

vertices.push( - size, 0, k, size, 0, k );
vertices.push( k, 0, - size, k, 0, size );

this causes the grid to rotate 90 degrees, from horizontal to vertical.

Editor.js ( 9):

this.DEFAULT_CAMERA.position.set( -20, 20, -20 );

this.DEFAULT_CAMERA.position.set( 20, 10, 20 );

this.DEFAULT_CAMERA.up.set( 0, 0, -1 );

position.set .

, .

+2
1

three.js THREE.Object3D.DefaultUp, (up vector), .
, , , , .

three.js (0, 1, 0), , THREE.Object3D, , y .

Object3D.DefaultUp = new Vector3 (0, 1, 0);

, z , (0, 0, 1) ( , , , (0, 0, -1)).

, - up, , , , . :

THREE.Object3D.DefaultUp.set( 0, 0, 1 );

, three.js, , , .

+1

Source: https://habr.com/ru/post/1679639/


All Articles