I have a problem with joystick and swiping screen. I have created swiping to rotate the camera using new input system and I have joystick created on the left bottom corner. what my problem is when I use joystick, both joystick and swiping screen functions working together. And it is not good because I don't want the swiping function response when I pressing joystick.
I have no idea.
I would like to limit the the touchable area and how can i do it
CodePudding user response:
I would use IsPointerOverGameObject()
(documentation).
In your swipe logic, check if the pointer with the given ID is not over an EventSystem object before rotating the camera. Something like this:
if(!EventSystem.current.IsPointerOverGameObject()) {
// the pointer is not over any UI objects, rotate the camera
} else {
// the pointer is over a UI object, do not rotate the camera
}
If needed, in the UI space that the user will use to swipe and rotate the camera you can add a transparent Image with the Raycast target set to false to ensure that EventSystem.current.IsPointerOverGameObject()
will return false.