TNT: randomly vary ejecting velocity

We add a +/- 0.5 random value to the velocity vector of
ejecting nodes.

I've spotted a lot of nodes going exactly straight up if blowing
up sand above TNT. The extra variation looks less artificial.
This commit is contained in:
Auke Kok 2016-04-16 12:13:13 -07:00 committed by paramat
parent d6c33da355
commit 8b384fb257
1 changed files with 7 additions and 0 deletions

View File

@ -123,6 +123,13 @@ 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)
-- randomize it a bit
vel = vector.add(vel, {
x = math.random() - 0.5,
y = math.random() - 0.5,
z = math.random() - 0.5,
})
-- Limit to terminal velocity -- Limit to terminal velocity
dist = vector.length(vel) dist = vector.length(vel)
if dist > 250 then if dist > 250 then