Forum rules - please read before posting.

Pinch Zoom and Panning on Mobiles

24

Comments

  • it has a public field where I need to put the camera in Editor. So it does not matter which one I put there, even though a different camera may be used during gameplay?

    It does - it'll need to be reworked to adapt to different PanZoom components.

    Though, we now have a conflict with PanZoom and ResetDragCamera - since both are now controlling the position of the camera.

    Another rewrite may be necessary.

    1. Are all of your cameras draggable/zoomable?
    2. What is your Interaction method?
  • edited February 15

    Yes, all of them are dragable and zoomable. I am using two, because I have a horizontally long scene with two entry points, each one on the opposite side. Each camera has a different Position set so when you enter the scene from the particular point, the camera is already focused on you.

    I tried to use only one camera now based on the latest scripts from you. But at the beginning of the scene, the camera starts in the middle of it and then shifts to focus on the player. I need it to be already in the position when the scene starts, I don't want it to fly over the scene to you. If this is possible to set somehow (that the camera would just teleport to focus on the player and not move there), then I wouldn't need two cameras.

    1. Yes, all draggable/zoomable
    2. Point and click, mouse and keyboard
  • edited February 16

    The script can be adjusted to have it snap to the Player whenever they themselves teleport to a Marker / PlayerStart.

    Point and click, mouse and keyboard

    I'm referring to the "Interaction method" setting, i.e. Context Sensitive etc.

    As the three scripts are all interdependent, it might be better to combine into one - and instead of overriding input, disable default movement / interactions and instead control them through input.

    This script will require a change to AC's PlayerMovement script, which I will make to the next release. In the meantime, however, you'll need to edit it manually, inserting the following function:

    https://paste.ofcode.org/TrP5uizyL8EQd8ThVejHix

    You'll then be able to make use of this script, replacing the three other custom scripts:

    https://paste.ofcode.org/83H5B4GNDmbeDCZ3Gczm5E

    However, this replaces AC's default movement and interaction systems - so you'll need to set your Movement method to None, and Interaction method to Custom Script. The script may need to be tweaked further to emulate your existing interaction system.

  • On the desktop, all seems to work properly! Also, the camera snaps to the player at the start of the scene :-)

    On Android, however, the pinch Zoom seems to be still causing problems. The camera sometimes just jumps across the place when you try to zoom, and ultimately it flies outside of the scene into black.

    Would it be also possible to add an editor-adjustable value of the zoom speed?

  • Ah. Forgot the DefaultExecutionOrder attribute.

    Try this, which also includes a zoom speed variable:

    https://paste.ofcode.org/TjejxV36pegdQJi7C9dNMd

  • Unfortunately, the problem persists. On top of that, when I change the zoom speed to anything besides the default 1, it messes up the zoom even more. On the desktop, the scrolling wheel then behaves more like panning. On Android, once I zoom in I can't zoom out. The camera still twitches and jumps across the scene, although it seems it does not jump outside of it completely.

  • edited February 19

    Sadly once I enter any value but 1 in the zoom speed, the camera still breaks (now went completely black) on Android and does not zoom on Desktop.

    I just realized the camera twitching happens when I want to remove my fingers from the screen after I zoom in. It happens when you don't remove both fingers from the display at the exact same time or when you leave one finger touching the display. Could it perhaps be solved by canceling the calculation of the zooming focus point between the two pinching fingers immediately when only one finger is detected on the display? Or/and set some 0,5 second pause of any zooming/panning/centering once two fingers are not detected on the screen anymore? (so it does not immediately jump to panning/center point calculating).

    And a minor thing - when the camera automatically following the player is active (panning was not used) and I zoom somewhere, it doesn't stay on the zoomed section, but scrolls back to focus on the player. Could it be set that once any zooming is detected, the drag camera is set as the active one? This would then leave the camera focused on the zoomed section regardless of which camera type is currently active.

  • I will have a look.

  • Everything seems to work as it should! Many many thanks, Chris! :-)

  • edited February 29

    I found an issue that I suspect is connected with the SuperScript. The Hotspot Interactions setting Walk To Marker stopped working. Now if I click a hotspot with exit from the scene, the character exits the scene even if I click somewhere else before he reaches the hotspot area to interact with it. I assume it has something to do with the new input system (otherwise working great!) as this issue did not happen before.

  • What's the exact behaviour - does "ExitDoPole" run before or after the Interaction of the other Hotspot being clicked on?

    I can't recreate the issue from the above description - if you can provide steps to set this up, I'll follow them and take a look.

  • There is no other hotspot. Only the Exit one. I click the hotspot, and the Player heads towards it. Before reaching it, I click somewhere else on the navmesh, so the player changes direction and does not go to the hotspot anymore. Its action is set to be executed only after the player walks to it. But the hotspot action gets executed anyway, without the player reaching the hotspot, although it is set to do that.

    I tried it on a basic version not using the superscript, only simple GameCamera2D and it behaves as it should. the action of the hotspot does not get executed if before reaching it, I make the player walk somewhere else on the navmesh.

    here are screenshots of the setting of the hotspot and its action:

  • What is your AC version, and have you set your Movement method to None?

  • Version 1.79.1 and movement method: None. Could that be the reason?

  • Also, I would like the player to Walk to an Object on the scene before picking it up and adding it to the inventory. Now when I click it, it gets added immediately. I did not find any action type that would tell the player to reach the object first.

  • Edit: I found the Character - Move to point, but there is the same problem with the hotspot as I originally described. Even if I change the path and the player never reaches the hotspot, the action (leaving to another scene/picking up object) gets performed anyway.

  • I cannot recreate this behaviour. You will need to PM me your project with instructions on how to view it.

  • PM sent.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.