refactoring
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
import {
|
||||
Clock,
|
||||
Vector3
|
||||
} from 'three';
|
||||
import { Vector3 } from 'three';
|
||||
|
||||
import { PointerLockControls } from 'three/examples/jsm/Addons.js';
|
||||
|
||||
@@ -18,7 +15,6 @@ class PointerControls {
|
||||
|
||||
this.camera = camera;
|
||||
this.hero = hero;
|
||||
this.clock = new Clock();
|
||||
this.click = false;
|
||||
|
||||
this.controls = new PointerLockControls(camera, domElement);
|
||||
@@ -61,40 +57,7 @@ class PointerControls {
|
||||
this.controls.isLocked && this.onpointer && this.onpointer('end');
|
||||
});
|
||||
|
||||
this.update = () => {
|
||||
// const delta = this.clock.getDelta() * 10;
|
||||
// if (this.gp) {
|
||||
// this.gp = navigator.getGamepads()[this.gp.index];
|
||||
// this.gp.pressed = this.gp.buttons[4].pressed || this.gp.buttons[5].pressed || this.gp.buttons[6].pressed || this.gp.buttons[7].pressed || this.gp.buttons[9].pressed;
|
||||
// if (!this.click && this.gp.pressed) {
|
||||
// this.click = true;
|
||||
// this.clicked?.();
|
||||
// //console.log(this.gp.buttons.map((b,i)=>[i, b.pressed]));
|
||||
// }
|
||||
// if (this.click && !this.gp.pressed) this.click = false;
|
||||
// }
|
||||
// //this.velocity.x -= this.velocity.x * 5.0 * delta;
|
||||
// this.velocity.z -= this.velocity.z * 5.0 * delta;
|
||||
// this.rvelo -= this.rvelo * 5 * delta;
|
||||
// // this.velocity.y -= 9.8 * 100.0 * delta; // 100.0 = mass
|
||||
// this.direction.z = Number(this.moveForward) - Number(this.moveBackward) - Math.floor((this.gp && this.gp.axes[1] || 0) * 100) / 100 + (this.touchControls && this.touchControls.move || 0);
|
||||
// this.rotationY = Number(this.rotateLeft) - Number(this.rotateRight) - Math.floor((this.gp && this.gp.axes[0] || 0) * 100) / 110 + (this.touchControls && this.touchControls.rotate || 0);
|
||||
// //this.direction.x = Number( this.moveRight ) - Number( this.moveLeft );
|
||||
// //this.direction.normalize(); // this ensures consistent movements in all directions
|
||||
// if (this.direction.z) this.velocity.z -= this.direction.z * 5.0 * delta;
|
||||
// //if ( this.moveLeft || this.moveRight ) this.velocity.x -= this.direction.x * 5.0 * delta;
|
||||
// if (this.rotationY) this.rvelo -= this.rotationY * 8 * delta;
|
||||
|
||||
//this.velocity.x && this.controls.moveRight( - this.velocity.x * delta );
|
||||
// if (this.velocity.z) {
|
||||
// this.controls.moveForward(-this.velocity.z * delta);
|
||||
// this.hero.position.z += -this.velocity.z * delta;
|
||||
// }
|
||||
// this.controls.moveRight( this.direction.x * delta );
|
||||
// this.controls.moveForward( this.direction.z * delta );
|
||||
// this.hero.position.y += (Number(this.moveUp) - Number(this.moveDown)) * delta;
|
||||
// this.hero.rotation.y += -this.rvelo * delta;
|
||||
};
|
||||
this.update = () => { };
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user