entity: physics rewrite

This commit is contained in:
2022-02-01 23:48:39 +08:00
parent 25872b257d
commit 37ee76e9fc
9 changed files with 201 additions and 256 deletions

View File

@@ -166,6 +166,7 @@ func (g *Game) Init(win *glfw.Window) {
igwrap.MouseScrollCallback(xpos, ypos)
}
})
}
const airAccel = 0.1
@@ -234,7 +235,7 @@ func (g *Game) Update(win *glfw.Window, delta time.Duration) {
io.ViewPos = g.player.EyePosition()
io.ViewDir = itype.Vec3d(mgl64.Rotate3DY(float64(g.rotY.Radians())).Mul3(mgl64.Rotate3DZ(float64(itype.Degrees(g.rotZ)))).Mul3x1(mgl64.Vec3{1, 0, 0}))
render.Framewire.PushBox(g.player.WorldHitbox().ToFloat32(), color.White)
render.Framewire.PushBox(g.player.WorldHitbox()[0].ToFloat32(), color.White)
if g.player.Position()[1] < -100 {
g.player.SetPosition(itype.Vec3d{18, 80, 18})