I need help making two things happening at once
I m trying to make it so that my velocity based movement has friction
this is my code
if v > 0 then v-=1 end if v < 0 then v+=1 end
I m trying to make it so that my velocity based movement has friction
this is my code
if v > 0 then v-=1 end if v < 0 then v+=1 end
For realistic friction, I recommend something like the following:
trunc = function(x)
if floor(x) == x then
return x
end
if x > 0 then
return floor(x)
end
return ceil(x)
end
update = function()
v = trunc(v * 0.8)
end
thanks