I came across a bug recently that I don’t think has been reported about in this forum (I did search). I’m working on a game with vehicles where I’m currently using the out-of-box solution offered with the VehicleSeat object. The bug is that if the player is currently sitting, turns the steering wheel (use arrow keys), and while the steering is turned the player then jumps out, the steering wheel (aka Steer value) will be locked in the direction it was last at when the player sits back into the seat. Note after this bug is present you can turn the steering wheel to the center, but it then snaps back when they “let go”. As far as I can tell there’s not a hacky way to clear this state except to destroy and recreate the VehicleSeat, or in some cases the player can wiggle the steering back and forth (getting in/out of the seat, etc).
I traced what I think is the bug to the PlayerModule->ControlModule->VechicleController script. In VehicleController.lua you have this function:
function VehicleController:Enable(enable, vehicleSeat)
if enable == self.enabled and vehicleSeat == self.vehicleSeat then
return
end
self.enabled = enable
self.vehicleMoveVector = ZERO_VECTOR3
if enable then
if vehicleSeat then
self.vehicleSeat = vehicleSeat
self:SetupAutoPilot()
self:BindContextActions()
end
else
if useTriggersForThrottle then
ContextActionService:UnbindAction("throttleAccel")
ContextActionService:UnbindAction("throttleDeccel")
end
ContextActionService:UnbindAction("arrowSteerRight")
ContextActionService:UnbindAction("arrowSteerLeft")
self.vehicleSeat = nil
end
end
If I locally modify the code to the following the problem/bug goes away for me:
function VehicleController:Enable(enable, vehicleSeat)
if enable == self.enabled and vehicleSeat == self.vehicleSeat then
return
end
self.enabled = enable
self.vehicleMoveVector = ZERO_VECTOR3
if enable then
if vehicleSeat then
self.vehicleSeat = vehicleSeat
self:SetupAutoPilot()
self:BindContextActions()
end
else
if useTriggersForThrottle then
ContextActionService:UnbindAction("throttleAccel")
ContextActionService:UnbindAction("throttleDeccel")
end
ContextActionService:UnbindAction("arrowSteerRight")
ContextActionService:UnbindAction("arrowSteerLeft")
self.turningLeft = 0 -- my added code
self.turningRight = 0 -- my added code
self.steer = 0 -- my added code
self.vehicleSeat = nil
end
end
The issue most likely happens in other games, but if want to see it in action you can go here and reproduce it:
Hopefully this is helpful, and selfishly I would love to see this fixed is an official release.