How Can I Set Position of Virtual Joystick in Viewport Across Multiple Devices?

Using a Virtual Joystick in my action shooter game, used to pan the view around; it’s essentially the same as just the LeftVirtualJoystickOnly interface. I’m trying to get it to stay in the same location, but it can’t do so across multiple platforms.

The center point of the control in the touch interface moves based on resolution of the device, whether or not I’m going the route of having it be relative to the screen or in an absolute position. I have an image in a widget behind the touch interface featuring a round space; I want my virtual joystick to land in the middle of that. However while X-.18 & Y-.48 may put it in the right position for an 18.5/9 ratio, the story is different for a 16:9 ratio.

What can I do to better control the position of the virtual joystick?

hello ~ have any Resolution? i meet this same problom…

same here… any one ?

Well it does recenter automatically, check default joystick center value. The Y coordinate is set to negative, that’s where magic happens. Play with those value for your desired location, i learn that if i use both x and y coordinate as positive than it will not re adjust location for all device.

Inside your TouchInterfaceSetup, there’s a bool for Prevent Recenter. Check this on and it won’t reposition itself on the screen.

If you read the Tool tip on the Center value, it says a value less than 1 is relative. If you set the center to 0.5, 0.5 then it will center the Thumbstick on the screen. Greater than 1 becomes an absolute value of where you want it to position on the screen.

1 Like