I am currently making a Mobile racing game. that uses tilt controls to steer.
whenever the vehicle is stopped, everything is normal. But once gaven speed, everything looks as if the position of every object is changing rapidly.
Main:
wait(1)
script.Parent.Vehicle:SetPrimaryPartCFrame(script.Parent.PrimaryPart.CFrame)
script.Parent.LocalScript.UpdateSteer.OnServerEvent:Connect(function(p,cf)
script.Parent.DR.CFrame = cf
script.Parent.DR.Orientation = Vector3.new(0,script.Parent.DR.Orientation.Y,0)
script.Parent.Vehicle.PrimaryPart.Accelerate.Force = script.Parent.PrimaryPart.CFrame.LookVector * 100000--script.Parent.Vehicle.Values.Power.Value * 10000
end)
script.Parent.LocalScript.Accelerate.OnServerEvent:Connect(function()
script.Parent.Vehicle.Values.Power.Value = script.Parent.Vehicle.Values.Power.Value + 1
end)
while wait() do
script.Parent.PrimaryPart.Orientation = Vector3.new(0,script.Parent.PrimaryPart.Orientation.Y,0) + Vector3.new(0,script.Parent.DR.Orientation.Y/50,0)
end
LocalScript
--game.Workspace.Camera.CameraType = Enum.CameraType.Scriptable
while wait() do
local I,C = game:GetService("UserInputService"):GetDeviceRotation()
script.Parent.LocalScript.UpdateSteer:FireServer(CFrame.new(script.Parent.DR.Position,script.Parent.DR.Position+C.LookVector * 100))
--game.Workspace.Camera.CFrame = script.Parent.Head.CFrame + script.Parent.Head.CFrame.LookVector * -5 + Vector3.new(0,1,0)
end
function Accelerate()
script.Accelerate:FireServer()
end
local CAS = game:GetService("ContextActionService")
CAS:BindAction("Accelerate",Accelerate,true,"m")
CAS:SetTitle("Accelerate","Accelerate")