Forum rules - please read before posting.

Detecting Multiple Hotspots

edited December 2017 in Technical Q&A
Is it possible to be able to detect more than 1 hotspot at the same time? I would like to be able to detect like 6 hotspots once when in the vicinity of them. Basically multiple active hotspots at once when I'm in the vicinity of them,

I would then use a custom script to be able to open the interaction menus when very close to one.
«1

Comments

  • I assume you set it up that way so that more than 1 hotspot can't be interacted with at once. Where in the scripts can I find it to change
  • edited December 2017
    The code to select Hotspots is primarily in PlayerInteraction's CheckForHotspots function, but I would recommend first looking into writing code that sits atop AC instead of replacing it.  Section 5.1.4 of the Manual covers custom interaction systems.
  • I'm not that good at coding so I cant just write code to do stuff like that. I'm searching the code to find out how to detect more than 1 hotspot at a time but im not finding much luck
  • edited December 2017
    What's your Movement method?  When set to Direct, an additional option appears under Hotspot settings allowing you to set a Hotspots in vicinity field to Cycle Multiple or Show All, depending on preference.

    You will need to explain in more detail what it is you're trying to achieve here.  If you set that option (ignoring your intended movement method for the moment), is that what you're after?

    If coding is not your strength then I certainly wouldn't recommend trying to tweak AC's scripts.  The provided methods covered in the Manual are intended to make it much easier to make changes.

    Hotspots can be highlighted manually, and custom UI Text boxes can display their labels.  A Hotspot doesn't have to be "selected" by AC in order to run its interactions or open an Interaction menu for it - if their selection as you intend is just visual then you might be able to just write that on top of AC's default interaction behaviour.  Again, if you can be really clear about what you want then it may be possible to give more specific advice.
  • I'm using the Unity TPC that comes with the standard assets. I have it setup working well enough and using detect hotspots scripts.

    What I really want to do is use 2 triggers. 1 to detect when near hotspots, so that multiple hotspot icons will appear on screen. Then when you very close to a hotspot, the interaction menu will open up. 

    I'll have more time to look into it tomorrow.
  • To elaborate more, I have movement method set to Direct and using nearest only to display hotspots. I tried show all but that didn't work and cycle multiple didnt work the way i wanted it to.

    What I want is to be able to detect multiple hotspots at once when I'm almost close to them, like when im in their vicinity then if i walk closer to a hotspot, then the interaction menu can open up.

    All i need is way to display more than 1 hotspot at a time.
  • edited December 2017
    In what way does "Show All" not work?  All Hotspots within the Hotspot Detector should highlight, but bear in mind that only one Hotspot label can show at a time.

    You'll need to be specific about what you mean by "displaying" a Hotspot - do you mean highlighting it?  Showing it's label?  Or have multiple Interaction menus show up at once?

    I'm not yet clear if what you're asking for is purely cosmetic or involves changing the way interactions themselves work.  Screenshots / mockups always help with visual problems such as these.
  • image



    I mean something like that. I want to see multuple hot spot labels when I'm in the vicinity just like that. 


  • OK.  And what is your Input method?
  • My input method is direct. I'm using keyboard controls . I'm using the unity Third person controller. I have it working pretty well.

    I feel like using 2 colliders,1 to detect the hotspots then another 1 to turn on the interaction menus.
  • To elaborate more. 
    Right now, I use the sphere collider to detect hotspots in vicinity with the detect hotspots script.  When I get close to a hotspot, it shows the interaction menu straight up.

    What I want, is just like in the image above. I want to be able to see multiple hotspot labels before i get very close to them. Then when I get very close to the hotspot, the interaction menu opens up.

    That's why I think using 2 colliders should work. 1 showing the hotspot labels when in the vicinity, then one to open up the interaction menus.

    I hope you understand what I mean now.

    In the scripting, is there a way to show more than 1 hot spot label at a time?

    In the settings there's something called show hotspot icon, but that's not what i want.
  • As I see it, there are two aspects of this:

    1) Showing multiple Hotspot labels at a time

    AC's built-in Hotspot menu only allows for one at a time, but it's possible to have one appear using the Highlight component's on/off events.  Through script, an instance of the Hotspot menu can be generated and tied to a Hotspot directly, and will show when highlighted.  The "Show All" option will highlight all within the Player's vicinity collider.

    (Note that a Highlight component doesn't have to literally highlight the Hotspot, but it's necessary to have special / custom effects when the Hotspot is selected)

    2. Show the Interaction menu automatically for the nearest Hotspot.

    The Settings Manager has See interactions with and Close interactions with fields that can both be set to Custom Script.  When done so, the functions necessary to open/close the Interaction menu is shown underneath.  As well as detecting all Hotspots within its collider, the "Detect Hotspots" script also keeps a record of the one closest to its centre, so it should be possible to use just the one.

    I'll need to make some changes to the API to expose the functions necessary to achieve these two things, but once done it should be a case of just a couple of very simple scripts to do both of the above.  I'll include these changes in v1.60.5, and will update this thread with such scripts - which can be modified to suit if necessary.
  • Alright then. Waiting for 1.60.5
  • Thanks for this really.

    There are a couple of issues though. I struggled and finally got it working but only when It's on Adventure Creator UI source. My custom UI doesn't work for it at all. 
  • After doing some more testing, I found something out. If there's only 1 item within the player vicinity, it shows the interaction menu and the hotspot label no matter if you're far away from the object.

    It's supposed to only show the hotspot label but after moving closer to the object then it should show the interaction menu.
  • That's as it behaves for me.  Did you set the Highlight events up properly, and the "Hotspots in vicinity" to "Show All"?  Let's see your full Settings Manager and the component Inspectors involved.
  • edited December 2017
    image

    image


    image

    image


    These are all the images. the multi hotspot script is on the tower viewer gameobject. Hotspot2 menu is a new menu to display the hotspot label. 

    I mentioned earlier that it only seems to work with the adventure creator ui not my custom ui.



  • And there's a separate Multi Hotspot Label / Highlight pair of components for each Hotspot?  When it is working, is it working fully (i.e. all Hotspots show their labels)?

    When you say "Adventure Creator UI", do you mean the default Unity UI or the Adventure Creator source option?  Is your custom UI "In Scene" like your Interaction UI, or a prefab?
  • To give a clearer example. Let's day, the gameobject of a lamp in my scene has the highlight object and multi hotspot label script on it. 

    When it's working it shows the hotspots close by fine and when I get closer, the interaction pops up. 

    The issue i have is, if there;s only 1 hotspot in the scene, the interaction menu opens up the moment the hotspot label is active.

    I mean using the default adventure creator source option. That's the only way it works for the hotspot.

    I can't use my custom hotspot ui either in the scene of prefab.
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.