Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Zvyozdo4ka authored Oct 18, 2021
1 parent 96c9cb9 commit 18f25e1
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions task12 fix_orbit_control.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,29 @@
let material__ = new THREE.MeshBasicMaterial( { color: glance * 0xffa100 } );
let line__ = new THREE.Line( geometry__, material__ );

renderer = new THREE.WebGLRenderer( { antialias: true } );
camera = new THREE.PerspectiveCamera( 10, window.innerWidth / window.innerHeight, 1, 3000 );
container.appendChild( renderer.domElement );
let controls = new OrbitControls( camera, renderer.domElement );

function init() {

clock = new THREE.Clock();

renderer = new THREE.WebGLRenderer( { antialias: true } );
//renderer = new THREE.WebGLRenderer( { antialias: true } );

renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );

container.appendChild( renderer.domElement );
//container.appendChild( renderer.domElement );

scene = new THREE.Scene();
//scene.background = new THREE.Color( 0xbfe3dd );
camera = new THREE.PerspectiveCamera( 10, window.innerWidth / window.innerHeight, 1, 3000 );

//camera = new THREE.PerspectiveCamera( 10, window.innerWidth / window.innerHeight, 1, 3000 );
camera.position.z = 500;

const controls = new OrbitControls( camera, renderer.domElement );
//const controls = new OrbitControls( camera, renderer.domElement );
controls.target = new THREE.Vector3(0, 0, 0);
controls.minDistance = 50;
controls.maxDistance = 1000;
Expand Down Expand Up @@ -230,23 +237,23 @@
}

function LeftClick (event) {
if ( moved === false ) {
if ( moved === false || controls.mouseButtons) {
object_exist = true;
checkIntersection( event.clientX, event.clientY, geometry) ;
if ( intersection.intersects ) {
if ( intersection.intersects) {
shoot(intersection.point);
}
}
}

function shoot(point) {

//controls.enabled = false;
console.log("event", event.currentTarget)

position.copy( intersection.point );
points_line.push(point.clone());

if ( moved === false ) {
if ( moved === false || controls.mouseButtons) {

sphereInter.visible = true;
sphereInter.position.copy( position );
Expand Down

0 comments on commit 18f25e1

Please sign in to comment.