Multitouch joystick causing movement without being touched

Hi, to whoever sees this and thank you for your help. I am working on a project where I want to control two things with a joystick. I want to the character to jump when the joystick is moved upward, and I want a platform (not the character) to rotate when the joystick is moved left or right. The issue I am facing is that when I add the joystick functions and then do a preview the platform starts out with a rotational force that doesn’t stop. If I delete the joystick and just use the keyboard this doesn’t happen and it works perfectly. Are there certain things I need to do to stop the rotation at the beginning of the scene when the joystick isn’t being touched?

The platform I want to rotate has physics behaviors, don’t know if that changes the joystick functions.

You’ll need to show a screenshot of your relevant events, they are the most important piece of context and required to understand most issues.

Not much to show yet, but here it is. I currently have a couple lines disabled because I’ve been trying various things to fix the problem.

Also this…

:wave: Hi and welcome :slight_smile:
Maybe your joystick has a small calibration issue?
Try displaying the JoystickAngle() values in a text object to make sure the value is zero when you don’t touch it. :person_shrugging:
Aside from that, perhaps it’s an issue with your Physics settings.

I have exact problem wtf

1 Like

For sure not in his case as in mine since i tested it on various devices
Even on PC it just moves on it own

I still haven’t figured it out. I’ve deleted it and set it up again and again and every time I add the joystick to the game it immediately applies a force in the 0 angle. Nothing I have tried has had even the slightest effect on it. For the moment I’ve deleted the joystick so I can build the rest of the game and come back to the JS later. Good luck.

There are many examples of virtual joystick without the extension like self made and seem they work better at least you have documentation on how they work

This is for extension

Here is one self made

Problem is i don’t need it with force i need one where it is topdown movement

1 Like

The multitouch joystick extension has been updated in the latest release (.149), give it a try.

I would gladly give it a try if someone would explain to me why this CONDITION alone (in actions you have simple score counter)

Works like ACTION
And without that 1st action to activate joystick i don’t even have thumbstick to use
Where it should happen only if i move that thumbstick to the right
And this is on PC so i have no means to even move it
But when i test it on android phone even if i try it on android emulator it have exact same effect

So, to be clear: you should be trying the new version of the engine and extension as recommended before asking a question about the prior version, since your issue may be resolved.

As far as I can see, however, your question doesn’t really make sense. The condition isn’t acting as an action. The condition is being treated as “true”, therefore your actions in that event are running every frame. Whether it should be treated as true or not isn’t relevant to this scenario since there may have been bugs in older versions (including the version you’re using).

As far as the activate joystick action, this is mandatory to use the logic of the extension, along with adding the behavior to the thumbstick object. This is listed in the instructions for the extension when you install it. It doesn’t necessarily matter if you have the object in the scene or not, but not having the listed object in the scene will likely give you incorrect results when using the behavior and its conditions.

Thank you guys for the advice. I am now using the updated version of GD and uninstalled and reinstalled the MultitouchJoystick extension, but I’m still having the problem. I tried adding a line to remove all forces from the character at the beginning of the scene, and I’ve tried the same with the joystick, but neither worked. Unfortunately I can’t add a video but what happens is as soon as the scene starts the character immediately begins moving to the right and if I hit the left key to move the character left it only stops the character until I let go then proceeds to move right again. I added text to track JoystickAngle() and it always says 0. Any advice? I’m relatively new-ish to GD though I do have one game on the Play Store so I wouldn’t be surprised if I’ve made some stupid mistake lol.

While I can’t give much guidance on this in general (I’ve built only a single game for touch, and it wasn’t using a joystick): As a heads up, this has to happen Every frame. It cannot be just at the start of the scene. You’ll want to remove “At the beginning of the scene”.

This is mentioned in the multitouch joystick extension instructions (the text that pops up when you download the extension)

I changed it to once per frame, and tried moving the activate joystick behavior into the game events section, it still applies force to the right the same as before. (I had the activate joystick behavior running each frame before but tried to set it up differently to see if it would change anything, obviously it didn’t lol)

Problem is when i set it to left or up or down
Nothing happens
It only works like this with right
Test it yourself cause just like me you assume it should simply work as intended

It sounds like there might have been an attachment intended?

If setting it to any direction would make it detect it is automatically pressed in any of that direction then i would believe
But not only when it’s Right

Everything is working as I would expect.

You can give it a shot here:

Testing with a left press, right press, and a dead zone in the center. If I were to hazard a guess what you’re experiencing (without digging into the code), it’s detecting the angle of the stick from center of the range, which probably starts at 0. 0 degrees is right in JS coordinates.

You’d want to set a deadzone of some kind to ensure it’s not detecting dead center as a valid position.
Alternative to the one I have in the example, You could also add the condition “force of blah is greater than yournumberhere” (not inverted) to a separate event, then make all of your stick events subevents of that one. That’ll apply a deadzone to all of your directions with a single condition and event.

Edit: If you use the gamepad extension, I also strongly recommend you set up a deadzone for any stick usage, else you risk running into similar issues.

Funny you use that example
I am using exactly that one to mimic the controls

But well this is how it turns out
It automatically moves on start
I think problem is as you say with the dead zone
Because i don’t know how to limit my thumbstick to area of joystick background
Also if you look on the gif below you can notice it works just fine if i move it to lower left from joystick and release
Like only then it resets to none “active” position