Skip to content

Instantly share code, notes, and snippets.

@webD97
Last active February 23, 2017 16:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webD97/d5cc0c041d7fbf313fb6fbce25715001 to your computer and use it in GitHub Desktop.
Save webD97/d5cc0c041d7fbf313fb6fbce25715001 to your computer and use it in GitHub Desktop.
function vehicle:get_drive_direction_vector()
return vector.normalize(self.object:getvelocity())
end
function vehicle:on_step(dtime)
local frr = f_rr(0.015, f_n(0, self:get_mass()))
local vec = self:get_drive_direction_vector()
self:add_force(vector.multiply(vec, frr))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment