Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
Where'd you find the game.brokenvoxels variable, by the way?
I got it from the games challengeMayhem.lua function, as that game mode works based on how many destroyed voxels you have.
It's a pretty useful little trick to play with on a few things.
no clue if you are still here @Dev
but I made a small modification that leads to the object being destroyed once hitting the ground/ something else
it is far from perfect but imo looks much better when for example breaking Lee Chemical tower as it only gets destroyed when hitting the ground/ a building instead of breaking to bits the moment you cut it from the ground
code explanation:
I give the bodies that are broken (would be blown up in your original code) a tag that stores the velocity and once that velocity changes (decreases) below 0.1 of the max velocity, the breaking actually starts
the code is here:
local body = GetShapeBody(shape)
if body then
local mass = GetBodyMass(body)
local broken = IsBodyBroken(body)
local vector_vel = GetBodyVelocity(body)
local vector_len = VecLength(vector_vel)
local mass_modi = mass / 60000.0
local is_vehicle = GetBodyVehicle(body)
if is_vehicle == 0 then
if vector_len > 2 then
if mass > 500 and broken == true then
--evtl. lieber RIchtung statt Geschwindigkeit -> Richtungsaenderung
if not HasTag(body, "vela") then
SetTag(body, "vela", vector_len)
else
if tonumber(GetTagValue(body, "vela")) < vector_len then
SetTag(body, "vela", vector_len)
end
end
end
end
end
if HasTag(body, "vela") then
if vector_len < (tonumber(GetTagValue(body, "vela")) * 0.1) then
local bodyTransform = GetBodyTransform(body)
local mini, maxa = GetShapeBounds(shape)
local c = VecLerp(mini, maxa, math.random())
local cross = VecSub(mini, maxa)
local size_multi = mass / 5.0
MakeHole(c, size_multi, size_multi / 2.0, size_multi / 5.0)
-- DebugCross(cross)
-- DebugLine(bodyTransform.pos, cross, 1, 0, 0)
if GetBool("savegame.mod.dust") then
ParticleReset()
ParticleType("smoke")
ParticleColor(0.6, 0.55, 0.5)
ParticleDrag(0.15)
ParticleGravity(-.2)
for i = 50,1,-1
do
ParticleRadius(4.0)
local spread = math.floor(math.random() * (1000 - 1) + 1000) / 1000;
local v = VecScale(VecAdd(spread, rndVec(1.0)), 8)
v = VecAdd(v, VecScale(GetBodyVelocityAtPos(body, c)))
local l = rnd(10*0.5, 10*1.5)
SpawnParticle(c, v, l)
end
end
end
end
end
end
end
end[/code]
once that is done I will come back to teardown modding and will most likely upload my modified code. I have some other ideas I want to implement first though
would be great to see what improvements you can make.
i did so a little bit but I am not finished
and I am lacking motivation and time right now
sry