6 ForwardKey Keys = 1 << iota
18 type PlayerPos struct {
19 Pos100, Vel100 [3]int32
20 Pitch100, Yaw100 int32
23 WantedRange uint8 // in MapBlks.
26 func (p PlayerPos) Pos() (pos Pos) {
28 pos[i] = float32(p.Pos100[i]) / 100
33 func (p *PlayerPos) SetPos(pos Pos) {
34 for i, x := range pos {
35 p.Pos100[i] = int32(x * 100)
39 func (p PlayerPos) Vel() (vel Vec) {
41 vel[i] = float32(p.Vel100[i]) / 100
46 func (p *PlayerPos) SetVel(vel Vec) {
47 for i, x := range vel {
48 p.Vel100[i] = int32(x * 100)
52 func (p PlayerPos) Pitch() float32 {
53 return float32(p.Pitch100) / 100
56 func (p *PlayerPos) SetPitch(pitch float32) {
57 p.Pitch100 = int32(pitch * 100)
60 func (p PlayerPos) Yaw() float32 {
61 return float32(p.Yaw100) / 100
64 func (p *PlayerPos) SetYaw(yaw float32) {
65 p.Yaw100 = int32(yaw * 100)
68 func (p PlayerPos) FOV() float32 {
69 return float32(p.FOV80) / 80
72 func (p *PlayerPos) SetFOV(fov float32) {
73 p.FOV80 = uint8(fov * 80)
76 func (p PlayerPos) StoodOn() [3]int16 {
77 return p.Pos().Sub(Vec{1: 5}).Int()