What do you want to achieve? See how a touch-enabled client interact with the joystick at the bottom left of the screen. Something like UserInputService, but for the coregui joystick.
What is the issue? The issue is that i’m doing a driving system for touch enabled player, i wanna that they use the default joystick designed for walking, for control the speed, direction, ect… But i can’t find out how.
What solutions have you tried so far? I have tried to look into UserInputService, but nothing releveant found. I also tried to use TouchBegin, TouchMoved, TouchEnded to simulate like they were using the joystick, but it just not working well.
inputobject has a Vector3 pos of your input during hold, you have to calculate the magnitude based on where the touch origin started along with the current position
instead of using TouchStarted or anything else, i recommend handling it on the InputBegan and InputEnded and use RunService:BindToRenderStep() to find the magnitude between of 2 Vector3 pos.
input_sv.InputBegan:Connect(function(inputOBJ)
if inputOBJ.UserInputType == Enum.UserInputType.Touch and inputOBJ.UserInputState == Enum.UserInputState.Begin then
local pos = Vector2.new(inputOBJ.Position.X, inputOBJ.Position.Y)
run_sv:BindToRenderStep("magnitude", Enum.RenderPriority.Camera.Value, function(dt)
local dist = (pos - Vector2.new(inputOBJ.Position.X, inputOBJ.Position.Y)).Magnitude
--do something else
end
end
end)
under the player’s playermodule, you should be able to find the vehicle controller module and the modify the code related to the thumbstick.
I have experience modifying the Player:Move function for custom thumbstick controls, but for vehicles / being seated the behavior is controlled separately.
More complicated method: use PlayerModule
The whole camera/movement system is controlled by Roblox’s PlayerModule. You could copy and paste to your StarterPlayerScript to override Roblox’s default module. From here you can edit the code.
I have attached this relevant section inside of DynamicThumbstick that might help.
function DynamicThumbstick:DoMove(direction: Vector3)
local currentMoveVector: Vector3 = direction
-- Scaled Radial Dead Zone
local inputAxisMagnitude: number = currentMoveVector.Magnitude
if inputAxisMagnitude < self.radiusOfDeadZone then
currentMoveVector = ZERO_VECTOR3
else
currentMoveVector = currentMoveVector.Unit*(
1 - math.max(0, (self.radiusOfMaxSpeed - currentMoveVector.Magnitude)/self.radiusOfMaxSpeed)
)
currentMoveVector = Vector3.new(currentMoveVector.X, 0, currentMoveVector.Y)
end
self.moveVector = currentMoveVector -- you can read this to update your game's vehicle system
end```