mirror of
https://github.com/maaslalani/confetty.git
synced 2024-11-22 07:36:40 +00:00
simplify physics update
This commit is contained in:
parent
5b7a3f2027
commit
2918dcbd88
@ -58,8 +58,11 @@ func (p *Physics) Reset() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *Physics) Update() {
|
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.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.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 {
|
func (p Physics) Displacement() float64 {
|
||||||
|
Loading…
Reference in New Issue
Block a user