Search Unity

WebGL Mobile touch controls

Discussion in 'Web' started by savely00, Aug 25, 2019.

  1. savely00

    savely00

    Joined:
    Feb 27, 2014
    Posts:
    36
    Note: I am well aware of the fact the WebGL is not fully supported on mobile platform.
    Questions:
    1. What is the best way to add touch controls (swipe, pinch) to a WebGL game played on a mobile device?
    2. What about a laptop touch screen? It should work the same, isn't it?

    Thanks in advance.
     
  2. wetcircuit

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    1,409
    If you are using Unity UI, the touch controls should just work (assuming standard input settings in your project)

    I've been building WebGL1.0 for iPad / Safari. Buttons and swipes are all working.
     
    savely00 likes this.
  3. savely00

    savely00

    Joined:
    Feb 27, 2014
    Posts:
    36
    I have no problems with UI. I have a scene with orbit camera rotating around 3D objects. I'd like to be able to rotate them with swipe and zoom with pinch.
     
  4. doctorpangloss

    doctorpangloss

    Joined:
    Feb 20, 2013
    Posts:
    270
    Use the EventSystem appropriate for your game. It sounds like it's a 3D game, so use a combination of StandaloneInputModule + GraphicRaycaster for your UI and PhysicsRaycaster for your 3D objects.