simplify physics update

This commit is contained in:
Maas Lalani 2021-08-07 20:04:23 -04:00
parent 5b7a3f2027
commit 2918dcbd88
No known key found for this signature in database
GPG Key ID: F53774FA051C052A
1 changed files with 5 additions and 2 deletions

View File

@ -58,8 +58,11 @@ func (p *Physics) Reset() {
}
func (p *Physics) Update() {
p.current.pos.Y, p.current.vel.Y = p.current.pos.Y+p.current.vel.Y/p.fps, p.current.vel.Y+p.current.acc.Y/p.fps
p.current.pos.X, p.current.vel.X = p.current.pos.X+p.current.vel.X/p.fps, p.current.vel.X+p.current.acc.X/p.fps
p.current.pos.X += p.current.vel.X / p.fps
p.current.pos.Y += p.current.vel.Y / p.fps
p.current.vel.X += p.current.acc.X / p.fps
p.current.vel.Y += p.current.acc.Y / p.fps
}
func (p Physics) Displacement() float64 {