more physics tweaks
This commit is contained in:
parent
453850b5b2
commit
ad86535ca1
1 changed files with 9 additions and 8 deletions
|
@ -32,7 +32,8 @@ func (aw *Awakeman) Update() error {
|
||||||
ε = 0.2
|
ε = 0.2
|
||||||
restitution = -0.3
|
restitution = -0.3
|
||||||
gravity = 0.3
|
gravity = 0.3
|
||||||
jumpVelocity = -3.6
|
airResistance = -0.01 // ∴ terminal velocity = 30
|
||||||
|
jumpVelocity = -4
|
||||||
runVelocity = 1.4
|
runVelocity = 1.4
|
||||||
coyoteTime = 5
|
coyoteTime = 5
|
||||||
)
|
)
|
||||||
|
@ -55,8 +56,8 @@ func (aw *Awakeman) Update() error {
|
||||||
aw.vy = 0
|
aw.vy = 0
|
||||||
aw.coyoteTimer = coyoteTime
|
aw.coyoteTimer = coyoteTime
|
||||||
} else {
|
} else {
|
||||||
// Falling. v = v_0 + a, and a is gravity.
|
// Falling. v = v_0 + a, and a = gravity + airResistance(v)
|
||||||
aw.vy += gravity
|
aw.vy += gravity + airResistance*aw.vy
|
||||||
if aw.coyoteTimer > 0 {
|
if aw.coyoteTimer > 0 {
|
||||||
aw.coyoteTimer--
|
aw.coyoteTimer--
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue