Forum rules - please read before posting.

Use Item on Hotspot, InteractiveBoundary2d

is it possible to show some indicator that the player is too far from the interactive zone to use Hotspot? Maybe change Cursor or something? Now when Iam too far away the hotspot is not showing cos player is not in zon but I want to make player move there

Comments

  • It should be possible, but custom scripting will be necessary - so it'll depend on exactly what indicator you want to have. Can you share a mock-up screenshot?

  • Here a short video. I created a shotgun with fires at target when drag and drop it from inventory to hotspot. I used the interactive Boundary so he cant shot from miles away but it would be great to show some indicator to get closer to the target to be able to fire

    https://www.loom.com/share/2fae58bb16e4420eba57f6a8e5f976dc

  • You can use this script function to determine if the mouse is currently over a "distant" Hotspot while an inventory item is also selected:

    bool IsOverDistantHotspot ()
    {
        if (KickStarter.runtimeInventory.SelectedItem == null)
        {
            return false;
        }
    
        LayerMask HotspotLayerMask = 1 << LayerMask.NameToLayer (KickStarter.settingsManager.hotspotLayer);
        RaycastHit2D hit = UnityVersionHandler.Perform2DRaycast
        (
            KickStarter.CameraMain.ScreenToWorldPoint (KickStarter.playerInput.GetMousePosition ()),
            Vector3.zero,
            KickStarter.settingsManager.hotspotRaycastLength,
            HotspotLayerMask
        );
    
        if (hit.collider == null)
        {
            return false;
        }
    
        Hotspot hotspot = hit.collider.GetComponent<Hotspot> ();
        if (hotspot == null || !hotspot.enabled || hotspot.PlayerIsWithinBoundary ())
        {
            return false;
        }
    
        return true;
    }
    

    How you use it exactly will depend on what kind of indicator you wish to use.

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.