Hello!
I am working on a game based in a-chasis-tune and i just noticed that the inputs in mobile devices are not compatible with the car control. Is it possible to fix this?
Thanks for any help!
Sorry if this seems dumb but I’m not quite understanding your full issue. Can you be more specific when you say the inputs aren’t compatible? What type of inputs? What currently happens? What needs to be fix / Whats the end goal?
ContextActionService is great for creating the little mobile buttons that a mobile device can use and click to preform an action and a great starting place.
The movement of the car is done with AWSD, like the player but when i try to play on mobile devices the movement of the player is ok as always but once I get into the car the car can’t detect the movement with AWSD.
I think it’s because how inputs work on it but im not sure. Also I’m going to check the ContextActionService
Yea I would use ContextActionService and make 4 different buttons for W, A, S, D. And detect those inputs, and preform the movements. Thats atleast how I would do it. You could do other methods as well!
My main problem is that I would like to simulate the input of the AWSD keys for mobile, because the A-Chasis-Tune code is quite complex to modify, so maybe doing smth like that can help.
ContextActionService works both more mobile and pc when you bind an action with a InputType / KeyCode.
This is roblox’s example:
local ContextActionService = game:GetService("ContextActionService")
-- A car horn sound
local honkSound = Instance.new("Sound", workspace)
honkSound.Looped = true
honkSound.SoundId = "rbxassetid://9120386436"
local function handleAction(actionName, inputState, inputObject)
if actionName == "HonkHorn" then
if inputState == Enum.UserInputState.Begin then
honkSound:Play()
else
honkSound:Pause()
end
end
end
ContextActionService:BindAction("HonkHorn", handleAction, true, Enum.KeyCode.H)
When you ContextActionService:BindAction("HonkHorn", handleAction, true, Enum.KeyCode.H)
the “true” means to make a mobile button for this action, and Enum.KeyCode.H
is the computer action to trigger this action. While you don’t have too, you can have both systems use only ContextActionService Because the mobile button click and a computer user clicking H (In this example atleast) will trigger the same function, making it like its “simulate clicking the key”.
Just an idea though and you don’t have to use this if you want to keep your old computer compatible code!
Oh! I see, I’m going to try to make it after fixing some bugs and I’ll let you know! Thanks man!