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

@@ -3,6 +3,7 @@ package game
import (
"fmt"
"log"
"math"
"os"
"runtime"
@@ -52,7 +53,8 @@ func (g *Game) imgui() {
if imgui.BeginV("Player", nil, imgui.WindowFlagsAlwaysAutoResize) {
pos := g.player.Position()
vel := g.player.Speed()
imgui.Text(fmt.Sprintf("Pos: (%.5f, %.5f, %.5f), Vel: (%.5f, %.5f, %.5f)", pos[0], pos[1], pos[2], vel[0], vel[1], vel[2]))
igwrap.Text("Pos: (%.5f, %.5f, %.5f), Vel: (%.5f, %.5f, %.5f)", pos[0], pos[1], pos[2], vel[0], vel[1], vel[2])
igwrap.Text("VelXZ=%.5f, VelXYZ=%.5f", math.Sqrt(vel[0]*vel[0]+vel[2]*vel[2]), vel.Length())
}
imgui.End()