Attempts to fix new vehicle system

This commit is contained in:
Nikita Kruglickiy
2022-07-29 22:06:02 +03:00
parent ca83cc2515
commit ec65efcafc
4 changed files with 42 additions and 18 deletions

View File

@@ -6,3 +6,4 @@ TICK_INTERVAL = game.getTickInterval()
RAD_TO_RPM = 9.5493
RPM_TO_RAD = 0.10472
UNITS_PER_METER = 39.37
UNITS_TO_METERS = 0.01905

View File

@@ -1,3 +1,7 @@
--@include ./constants.txt
require('./constants.txt')
function getLocalVelocity(entity)
if not entity:isValid() then
return
@@ -11,7 +15,5 @@ function calculateWheelInertia(entity)
return Vector(0)
end
local originalInertia = entity:getInertia()
return Vector(originalInertia)
return entity:getInertia():setY(0.5 * entity:getMass() * math.pow(entity:getModelRadius() * UNITS_TO_METERS, 2))
end