Skip to content
Snippets Groups Projects
Commit 504961a0 authored by paramat's avatar paramat Committed by Milan
Browse files

cherry-pick from github.com/minetest/minetest_game> Tnt: Avoid divide-by-zero...

cherry-pick from github.com/minetest/minetest_game> Tnt: Avoid divide-by-zero errors in calc_velocity()
parent 32c5872b
Branches
No related tags found
No related merge requests found
Pipeline #
......@@ -104,6 +104,11 @@ end
local function calc_velocity(pos1, pos2, old_vel, power)
-- Avoid errors caused by a vector of zero length
if vector.equals(pos1, pos2) then
return old_vel
end
local vel = vector.direction(pos1, pos2)
vel = vector.normalize(vel)
vel = vector.multiply(vel, power)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment