bullet recoil, use tau
This commit is contained in:
parent
f5df911707
commit
5bcf22a6f8
2 changed files with 8 additions and 13 deletions
|
|
@ -18,10 +18,6 @@ function phys.update(actor, dt)
|
|||
actor.y = actor.y + math.sin(actor.angle) * dv
|
||||
end
|
||||
|
||||
function phys.rotate(actor, angle)
|
||||
actor.facing = (actor.facing + angle) % phys.tau
|
||||
end
|
||||
|
||||
function phys.apply(actor, force)
|
||||
local ax = math.cos(actor.angle) * actor.speed
|
||||
local ay = math.sin(actor.angle) * actor.speed
|
||||
|
|
@ -31,7 +27,7 @@ function phys.apply(actor, force)
|
|||
local y = ay + fy
|
||||
|
||||
local speed = math.sqrt(x ^ 2 + y ^ 2)
|
||||
local angle = math.atan2(y, x) % phys.tau
|
||||
local angle = math.atan2(y, x)
|
||||
actor.speed = speed
|
||||
actor.angle = angle
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue