Skip to content

Commit

Permalink
YT upload patch
Browse files Browse the repository at this point in the history
  • Loading branch information
pronuba66 committed Jul 23, 2017
1 parent c2907d1 commit e6d1156
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Gyroscope Working

Simulator shows how the gyroscopic precession works. This simulator is my understanding of the gyroscope. Neither the input measurments nor the resultants are valid and may be used for only educational purposes.
Simulator shows how the gyroscopic precession works. This simulator is my understanding of the gyroscope. Neither the input measurments nor the resultants are valid and may be used only for educational purposes.

### Controls

Expand Down
2 changes: 1 addition & 1 deletion build/gyro.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/gyro.min.js.map

Large diffs are not rendered by default.

23 changes: 13 additions & 10 deletions js/camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,25 @@ function _gyro_camera(gyro) {
var v_gyro = new THREE.Vector3().setFromMatrixPosition(gyro.group.matrixWorld);
var v_sphere = new THREE.Vector3().setFromMatrixPosition(gyro.spheres[0].matrixWorld);
var v_camera1 = new THREE.Vector3().setFromSpherical(new THREE.Spherical(parent.radius, parent.phi, parent.theta));
var v_camera2 = v_sphere.clone().add(v_gyro);
//var v_camera2 = v_sphere.clone().add(v_gyro);
//var v_camera2 = v_sphere.clone().sub(v_gyro).normalize().multiplyScalar(512).add(v_gyro);

gyro.camera1.position.set(v_camera1.x, v_camera1.y, v_camera1.z);
gyro.camera1.lookAt(new THREE.Vector3(gyro.group.position.x, gyro.group.position.y/2, gyro.group.position.z));

gyro.camera2.position.set(v_camera2.x, v_camera2.y, v_camera2.z);
//gyro.camera2.position.set(v_camera2.x, v_camera2.y, v_camera2.z);
gyro.camera2.lookAt(v_sphere);
//gyro.camera2.position.set(v_camera2.x-1, v_camera2.y+2, v_camera2.z-1);
//gyro.camera2.lookAt(v_sphere);
//gyro.camera2.rotation.x = gyro.gyroArrows.arrowHelperTorqueVertical[0].rotation.x;
//gyro.camera2.rotation.y = gyro.gyroArrows.arrowHelperTorqueVertical[0].rotation.y;
//gyro.camera2.rotation.z = gyro.gyroArrows.arrowHelperTorqueVertical[0].rotation.z;
var r = parent.radius/1024;
gyro.camera2.left = -r*960;
gyro.camera2.right = r*960;
gyro.camera2.top = r*540;
gyro.camera2.bottom = -r*540;
gyro.camera2.updateProjectionMatrix();
//gyro.camera2.rotation.z -= Math.asin((v_sphere.y-96)/96);
//console.log(Math.asin((v_sphere.y-96)/96)*(180/Math.PI))
//gyro.camera2.up = v_sphere;
// var r = parent.radius/1024;
// gyro.camera2.left = -r*960;
// gyro.camera2.right = r*960;
// gyro.camera2.top = r*540;
// gyro.camera2.bottom = -r*540;
// gyro.camera2.updateProjectionMatrix();
}
}
2 changes: 1 addition & 1 deletion js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@
var frame = -1;
var tref;
function loop(timestamp) {
tref = requestAnimationFrame(loop)
if(time === null) {
time = timestamp;
}
Expand All @@ -260,6 +259,7 @@
frame = seg;
animate();
}
tref = requestAnimationFrame(loop);
}
tref = requestAnimationFrame(loop);
}
Expand Down
Binary file added screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e6d1156

Please sign in to comment.