update
This commit is contained in:
@@ -18,6 +18,8 @@ function Wheel:initialize(vehicle, name, config)
|
||||
self.brakePower = config.BrakePower or 0
|
||||
self.handbrakePower = config.HandbrakePower or 0
|
||||
|
||||
self.rotationAxle = config.RotationAxle or Angle(0, 0, 1)
|
||||
|
||||
self.wireInputs = {
|
||||
[self.name] = 'entity'
|
||||
}
|
||||
@@ -52,6 +54,11 @@ function Wheel:initialize(vehicle, name, config)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local right = self.entity:getRight()
|
||||
local offsetRight = self.entity:getRight():rotateAroundAxis(self.entity:getUp(), self.offset)
|
||||
|
||||
self.dir = right:dot(offsetRight)
|
||||
end
|
||||
|
||||
function Wheel:getEntityRadius()
|
||||
@@ -70,7 +77,7 @@ function Wheel:createHolo(entity)
|
||||
local holo = holograms.create(
|
||||
entity:getPos(),
|
||||
entity:getAngles() + Angle(0, self.offset, 0),
|
||||
self.CONFIG.Model or 'models/sprops/trans/wheel_b/t_wheel15.mdl'
|
||||
self.CONFIG.Model or ''
|
||||
)
|
||||
holo:setParent(entity)
|
||||
|
||||
@@ -115,9 +122,10 @@ function Wheel:forwardStep(torque, inertia)
|
||||
end
|
||||
|
||||
if isValid(self.holo) then
|
||||
self.rot = self.rot + math.deg(self.angularVelocity) * TICK_INTERVAL
|
||||
self.rot = self.rot + math.deg(self.angularVelocity) * TICK_INTERVAL * self.dir
|
||||
|
||||
local angle = self.entity:localToWorldAngles(Angle(0, self.offset - self.customWheel.steerAngle, self.rot))
|
||||
local steerAngle = self.entity:localToWorldAngles(Angle(0, self.offset - self.customWheel.steerAngle, 0) + self.rotationAxle * self.rot)
|
||||
local angle = steerAngle
|
||||
|
||||
self.holo:setAngles(angle)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user