MCPcopy Create free account
hub / github.com/Angais/Fable5-mc / constructor

Method constructor

src/player.js:36–56  ·  view source on GitHub ↗
(world)

Source from the content-addressed store, hash-verified

34
35export class Player {
36 constructor(world) {
37 this.world = world;
38 this.pos = new THREE.Vector3(0.5, 80, 0.5); // feet center
39 this.vel = new THREE.Vector3();
40 this.yaw = 0;
41 this.pitch = 0;
42
43 this.onGround = false;
44 this.flying = false;
45 this.sprinting = false;
46 this.sneaking = false;
47 this.inWater = false;
48 this.headInWater = false;
49 this.hitWall = false;
50 this.eyeHeight = EYE_STAND;
51
52 this.walkCycle = 0; // accumulates with horizontal travel (view bob)
53 this.bobStrength = 0; // 0..1, eases in/out with movement
54 this.stepAccum = 0;
55 this.events = []; // {type, id?, impact?} drained by main
56 }
57
58 teleport(x, y, z) {
59 this.pos.set(x, y, z);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected