refactor pointerControls, move away from hero to gameEngine
This commit is contained in:
@@ -2,7 +2,7 @@ import { Vector3 } from 'three';
|
||||
import { PointerLockControls } from 'three/examples/jsm/Addons.js';
|
||||
|
||||
class PointerControls {
|
||||
constructor(camera, hero, domElement) {
|
||||
constructor(camera, domElement) {
|
||||
this.kb = {};
|
||||
this.dom = domElement;
|
||||
|
||||
@@ -14,7 +14,6 @@ class PointerControls {
|
||||
this.rvelo = 0;
|
||||
|
||||
this.camera = camera;
|
||||
this.hero = hero;
|
||||
this.click = false;
|
||||
|
||||
this.controls = new PointerLockControls(camera, domElement);
|
||||
@@ -117,6 +116,13 @@ class PointerControls {
|
||||
return this.moving && this.kb.ShiftLeft;
|
||||
}
|
||||
|
||||
get input() {
|
||||
return [
|
||||
this.moveLeft * 1 + this.moveRight * -1,
|
||||
this.moveForward * 1 + this.moveBackward * -1
|
||||
]
|
||||
}
|
||||
|
||||
async lock(unadjustedMovement = false){
|
||||
await this.dom.requestPointerLock( {
|
||||
unadjustedMovement
|
||||
|
||||
Reference in New Issue
Block a user