Forum rules - please read before posting.

Hotspot distinguish pinch vs tap

2»

Comments

  • edited April 9

    Thanks Chris, that has sorted that. One final question. The last way I used hotspots is the click and drag, as seen in 'Puzzle Template: Item Arranging'. I just noticed this custom script breaks this. From what I can see the system doesn't register the hold action until the touch is lifted, as the hotspot object remain stationary whilst held and then jitter a bit when released.

  • This approach won't be compatible with the Puzzle template, because the latter works with a single tap down + up to handle a single movement.

    Are your usages of this template in separate scene files? The best way around this would be to avoid using the script for the duration - while also switching your Interaction method back to Context Sensitive.

    This variant of the script will alter this field automatically as it gets enabled/disabled.

    using UnityEngine;
    using AC;
    
    public class TapUpInteract : MonoBehaviour
    {
    
        void OnEnable () { KickStarter.settingsManager.interactionMethod = AC_InteractionMethod.CustomScript; }
        void OnDisable () { KickStarter.settingsManager.interactionMethod = AC_InteractionMethod.ContextSensitive; }
    
        void Update ()
        {
            #if UNITY_EDITOR
            if (Input.GetMouseButtonUp (0))
            #else
            if (Input.touchCount == 1 && Input.GetTouch (0).phase == TouchPhase.Ended)
            #endif
            {
                Hotspot hotspot = KickStarter.playerInteraction.GetActiveHotspot ();;
                if (hotspot)
                {
                    if (InvInstance.IsValid (KickStarter.runtimeInventory.SelectedInstance))
                    {
                        hotspot.RunInventoryInteraction (KickStarter.runtimeInventory.SelectedInstance);
                    }
                    else
                    {
                        hotspot.RunUseInteraction ();
                    }
                }
            }
        }
    
    }
    
  • Unfortunately the usages of the Puzzle template are not in separate scene files.

  • You'll need to share more details, in that case.

  • edited April 10

    I can see the Interaction Method changes to Custom Script when I play the scene. It stays on Custom Script throughout all hotspot interactions, is the expected behaviour that it should disable aswell?

  • Currently, yes. It will stick to Custom Script until the script is disabled - or you leave the scene with it in.

    If you want to mix-and-match things, I'll need details on how you are integrating the puzzle template into a regular scene.

  • edited April 10

    Here's a visual of what I'm trying to accomplish. All those hotspots are run of the mill, tap to interact, or drop inventory item over. The cart in the middle is a hotspot that can be pressed and dragged to the other hotspots to move it to other rooms.

    I'm utilising the Puzzle template to give me that drag and drop functionality
    I have the Arranging Puzzle Manager in my Hierarchy, and passing it the cart hotspot as one of the Pieces.
    On that cart hotspot itself I have the Arranging Puzzle Piece script.
    I've several similar setups across my game, where I'm using the Slots and Pieces variables of the script to drag objects and rearrange them around the screen,

    image

    My Settings are as follows

    image

  • edited April 10

    As Hotspot input mode is set to Touch Up, is that not giving the same issue even when using Context Sensitive interactions? I'd have thought you'd need to set it to Touch Down to have it work.

    To disable the script when interacting with the Arranging Piece Hotspot, you could you could try attaching an Event Runner component to the scene, defining a Hotspot: Select event and have it run an Object: Call event Action that either enables/disables the TapUpInteract component based on whether or not the Hotspot parameter matches the Piece Hotspot. You can similarly re-enable it in the Inventory: Deselect event.

  • edited April 10

    The Hotspot input mode doesn't seem to be giving an issue. I can see when I click on the cart hotspot the Hotspot Input Mode setting changes to Touch Down, this must be why it is working. For all the other hotspots the settings remain Touch Up.

    Thanks I'll try and implement the above.

  • Thanks Chris, I've now been able to resolve this issue using the Event runner for Hotspot selections. Thank you very much for you help!

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.