I've a script snippet thats misbehaving or I'm just not understanding...
local pos = self:GetPosition()
local gnd = GetSurfaceHeight(pos[1], pos[3])
if gnd < 0 then
gnd = gnd * -1
end
WARN(' my pos: ', pos[2], ' gnd: ', gnd,' difference: ', pos[2] - gnd)
Output to log as my unit runs across a surface...
WARNING: <3
WARNING: my pos: 17.951171875 gnd: 17.951171875 difference: 0
WARNING: <3
WARNING: my pos: 17.951171875 gnd: 17.951171875 difference: 0
WARNING: <3
WARNING: my pos: 17.951171875 gnd: 17.951171875 difference: 0
WARNING: <3
WARNING: my pos: 17.951171875 gnd: 17.951171875 difference: 0
WARNING: <3
WARNING: my pos: 17.950664520264 gnd: 17.950727462769 difference: -6.2942504882813e-005
WARNING: <3
WARNING: my pos: 17.950534820557 gnd: 17.950595855713 difference: -6.103515625e-005
WARNING: <3
WARNING: my pos: 17.950534820557 gnd: 17.950595855713 difference: -6.103515625e-005
WARNING: <3
WARNING: my pos: 17.950534820557 gnd: 17.950595855713 difference: -6.103515625e-005
The difference value between myPos and gnd shouldn't be so extreme or varied. Is there a way to keep the values from going past 3 decimal points?
Cheers!
Resin