I have been working on a car chassis for my upcoming game. This car is very similar to Sleitnick’s Car Rigging Tutorial. After testing, this car has worked great, at least for laptops and desktops.
The problem seems to be occurring on mobile devices, specifically Apple devices. The problem is more or less down to the steering. Devices affected have this weird steering issue where they will be turning when they should be going straight. This problem is not occuring on my Samsung Galaxy Note 9, and I am noticing the moving controls for mobile seem to be different for Apple devices. I presume this is the problem.
Here is a recording of this weird issue occurring on an iPhone:
Under the hood, players have NetworkOwnership of their car. This is the function, connected to RunService.Heartbeat, responsible for controlling the car:
local function Update(dt)
-- Steer:
local steerGoal = -seat.SteerFloat * MaxSteerAngle
steer = steer + (steerGoal - steer) * math.min(dt * seat.TurnSpeed, 1)
attFL.Orientation = Vector3.new(0, steer, -90)
attFR.Orientation = Vector3.new(0, steer, -90)
-- Throttle:
local throttleGoal = seat.ThrottleFloat
throttle = throttle + (throttleGoal - throttle) * math.min(dt * seat.TurnSpeed, 1)
local torque = seat.Torque
local speed = seat.MaxSpeed * throttle
cylFL.MotorMaxTorque = torque
cylFR.MotorMaxTorque = torque
cylRL.MotorMaxTorque = torque
cylRR.MotorMaxTorque = torque
cylFL.AngularVelocity = speed
cylFR.AngularVelocity = -speed
cylRL.AngularVelocity = speed
cylRR.AngularVelocity = -speed
end
I presume the problem exists with the controls on these Apple devices giving odd numbers for my VehicleSeat’s SteerFloat and or ThrottleFloat.
Has anyone else come across this issue and maybe have a fix?