1
0
mirror of https://github.com/minetest/minetest_game.git synced 2024-09-26 05:40:22 +02:00

Limit entity speed to 250m/s.

Let's just call it "terminal" velocity.
This commit is contained in:
Auke Kok 2016-03-29 23:09:47 -07:00 committed by paramat
parent e6cef57661
commit 8114c3dbab

View File

@ -120,6 +120,12 @@ local function calc_velocity(pos1, pos2, old_vel, power)
-- Add old velocity -- Add old velocity
vel = vector.add(vel, old_vel) vel = vector.add(vel, old_vel)
-- Limit to terminal velocity
dist = vector.length(vel)
if dist > 250 then
vel = vector.divide(vel, dist / 250)
end
return vel return vel
end end