Files
firstProj/src/controllers/Player/Movement/MoveC.ts
T
Vasyl Kazakov ce3f254bc1 replaced files
2026-06-18 16:47:23 +03:00

31 lines
678 B
TypeScript

import { IMoveInput } from "../Input/MoveInput";
import { Vector3 } from "three";
export class MoveC {
private readonly input: IMoveInput;
private speed: number;
private readonly moveDirection = new Vector3();
constructor(input: IMoveInput, speed = 5) {
this.input = input;
this.speed = speed;
}
get Direction() {
return this.moveDirection;
}
get Weight() {
return this.moveDirection.length() / this.speed;
}
setSpeed(speed: number) {
this.speed = speed;
}
update(_delta: number) {
this.moveDirection.copy(this.input.CurrentDirection).multiplyScalar(this.speed);
}
}