Example codes for hydro mod
Now it is possible to make mods to the hydro mod.
The water adds readable variable named WaterHeight and if you want your actor to be unaffected by the water you just make his sharpness 2 (for some reason 0.9994253 didn't work).
Heres some basic codes you can play around with and get a idea how it works.
Code:
function Create(self)
end
function Destroy(self)
end
function Update(self)
local water = false
if WaterHeight ~= nil then
water = true
end
if water == true and self.Pos.Y + self.Vel.Y > WaterHeight then
self.Vel = self.Vel * 0.9
self.AngularVel = self.AngularVel * 0.9
end
end
Place this on a actor with sharpness = 2 and you've got a dude that walks on the bottom.
Code:
function Create(self)
end
function Destroy(self)
end
function Update(self)
local water = false
if WaterHeight ~= nil then
water = true
end
if water == true and self.Pos.Y + self.Vel.Y > WaterHeight then
self.Vel = self.Vel * 0.9 - 1
self.AngularVel = self.AngularVel * 0.9
self.AngularVel = self.AngularVel - ((self.RotAngle + self.AngularVel) * 0.015)
self.RotAngle = self.RotAngle * 0.99
end
end
This is a code you can attach on a crab (with sharpness = 2) to make it float like a boat.
These scripts won't make your mod need hydro to run.