Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.

Commit

Permalink
integrate gravity acceleration correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
blizzy78 committed Nov 12, 2020
1 parent 0a0cd21 commit 265201f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .golangci.yml
Expand Up @@ -6,6 +6,7 @@ linters:
- goerr113
- golint
- interfacer
- nakedret
- prealloc
- unconvert
- unparam
Expand All @@ -15,3 +16,5 @@ linters-settings:
min-complexity: 15
gocyclo:
min-complexity: 10
nakedret:
max-func-lines: 0
6 changes: 3 additions & 3 deletions _demo/main.go
Expand Up @@ -72,7 +72,7 @@ var demos = []demo{
{"BOIDS", boids, 0.5, 0.5},
}

var gravity = twodeeparticles.Vector{0.0, 9.81}
var gravity = twodeeparticles.Vector{0.0, 150}

func main() {
dot, _, err := ebitenutil.NewImageFromFile("bubble.png")
Expand Down Expand Up @@ -262,14 +262,14 @@ func fountain(rand *rand.Rand) *twodeeparticles.ParticleSystem {

if t == 0 {
a := 2.0 * math.Pi * randomValue(80.0, 100.0, rand) / 360.0
s := randomValue(450.0-25.0, 450.0+25.0, rand)
s := randomValue(315.0-25.0, 315.0+25.0, rand)
dir := angleToDirection(a)
v = dir.Multiply(s)
} else {
v = p.Velocity()
}

return v.Add(gravity.Multiply(30.0 * delta.Seconds()))
return v.Add(gravity.Multiply(delta.Seconds()))
}

s.ScaleOverLifetime = particleConstantVector(twodeeparticles.Vector{0.2, 0.2})
Expand Down

0 comments on commit 265201f

Please sign in to comment.