Forum rules - please read before posting.

Hotspot size (hitbox) when hovering over it with an inventory item selected

I have an issue that my players have difficulty using an inventory item on a hotspot in the scene because the hitbox of the hotspot is really small, even though I made the hotspot itself very large. Somehow when the cursor is changed to an inventory item the actualy hotspot box collidor is ignored?

What I would like is that when I use an inventory item my cursor becomes as big as the inventory item cursor, so it's easy for users to use the item on hotspots in the scene, how can I achieve this?

Comments

  • What are your AC/Unity versions, and cursor rendering mode? An item being selected shouldn't affect the Hotspot's size.

    Select the Hotspot in the Hierarchy and enable Gizmos in the Game window to visualise its size while playing. If it's not interactive when the mouse is over it, are there any colliders on the Default layer overlapping it?

    What kind of Collider are you using for the Hotspot? If you attach the Event Runner component, you could conceivably run a pair of Inventory/Select/Deselect events that change the Collider's size using animation.

  • Hey Chris, thanks for your tips to debug the problem. I added 2 screenshots to demonstrate my issue.

    I think the hotspot size itself is not issue but the "hitbox" of the item I am carrying (using as my mouse pointer) as that item can overlap with the hitbox (see screenshot)

    I am using Software cursor rendering.

  • A cursor - item-selected or not - only has one "selection point". This point is what needs to be over the Hotspot in order to select it.

    With Software rendering, this point defaults to the centre - though you can offset this in the Cursor Manager.

    It may be possible to rely on a custom script to auto-select the Hotspot when within the boundaries of the item - I'll give this some thought. What are your AC/Unity versions, and can you share a shot of your Settings Manager?

  • AC: 1.74.1
    Unity: 2020.3.42f1
    SettingsManager: https://pastebin.com/YgG3GTUJ

    I think your script idea is exactly what I need.

    In this specific case with this specific item we had play testers who knew what they needed to do in the game but just couldn't do it as the center of this item is not what you intuitively use as the selection point.

    I also thought about putting the selection point on the hook, as that's what one of the testers thought the selection point was, but then other testers assumed the tip of the pool cue was the selection point, so that didn't work either.

  • I've looked into this, and it's best to do it as a property within AC itself. For now, it'll be a "cursor radius" value that you can set through scripting, but the latter itself won't be complex at all.

    I'll include the change in the next release - update this thread once released and I'll give example code on how to use it.

  • Hello @ChrisIceBox I found this in the changelog of version 1.83, is this the new feature?

    Added: Ability to set - through script - the radius of the cursor raycasts used by the PlayerInteraction script in 2D games

  • It is - apologies for the delayed response in the thread.

    It's now possible to set the "interactive radius" of the cursor with:

    AC.KickStarter.playerInteraction.CursorRadius = value;
    

    A script such as this could affect its value when a given Inventory item - referred to by its ID number - is selected:

    using UnityEngine;
    using AC;
    
    public class CursorRadiusChanger : MonoBehaviour
    {
    
        public int itemID;
        public float newRadius = 0.1f;
    
        void OnEnable ()
        {
            EventManager.OnInventorySelect += OnInventorySelect;
            EventManager.OnInventoryDeselect += OnInventoryDeselect;
        }
    
        void OnDisable ()
        {
            EventManager.OnInventorySelect -= OnInventorySelect;
            EventManager.OnInventoryDeselect -= OnInventoryDeselect;
        }
    
        void OnInventorySelect (InvItem invItem)
        {
            if (invItem.id == itemID)
                KickStarter.playerInteraction.CursorRadius = newRadius;
        }
    
        void OnInventoryDeselect (InvItem invItem)
        {
            KickStarter.playerInteraction.CursorRadius = 0f;
        }
    
    }
    
  • Thank you so much @ChrisIceBox, it works perfectly!

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.