Forum rules - please read before posting.

Multi hotspot label Issues

edited March 2022 in Technical Q&A

Hi

I was wondering if this code still worked properly. While I have it working, I have issues like this.

As you see from the image, the middle one doesn't show. When I rotate the camera a little bit, it then appears.

When I move closer it dissappears.

When I'm next to it, it shows up sometimes but when i rotate the camera it shows fine.


I think it's a raycast issue.

Comments

  • Likely so. I've updated the wiki script with a LayerMask field, alternatively move your Player to the Ignore Raycast layer.

  • edited March 2022

    While its working better now, IT never turns off at all. Basically it shows all hotspots whenever in play mode. I have always show during gameplay checked.

    I thought it was supposed to go away whenever the character moves away from it.

  • I thought it was supposed to go away whenever the character moves away from it.

    Not if "Always Show During Gameplay" is checked. As an add-on script, though, you can amend it to suit your needs.

    To have it perform an additional distance check, replace:

    Vector3 direction = hotspotToShow.GetIconPosition () - Camera.main.transform.position;
    

    with:

    Vector3 direction = hotspotToShow.GetIconPosition () - Camera.main.transform.position;
    if (direction.sqrMagnitude > 10f) { Hide (); return; }
    

    And replace "10" with your desired maximum square distance.

  • Except I'm trying something wrong, when I add the code you posted above it doesn't work at all. It doesn't show the hotspots at all except when the character is near it.

    Is the code correct?

  • The way I expected it work is when the player gets close to a hotspot, it will show the names of the hotspots (This is because of the raycast). When they get next to the hotspot with the hotspot detector, the interactions pop up.

    Showing all the hotspots in the scene all the time is not good at all.

    That's the way it worked in the past.

  • It doesn't show the hotspots at all except when the character is near it.
    I thought it was supposed to go away whenever the character moves away from it.

    These two were one and the same, as I understood it.

    Showing all the hotspots in the scene all the time is not good at all.

    The "Always Show During Gameplay" checkbox will do this. If you uncheck it, the Menu's display will be synced with the Highlight component and only show when the Hotspot is made active, as normal.

  • I'm sorry but I cant get this to work anymore at all. I've unchecked always show during gameplay, i have the highlight component on but its not working. THe only time the hotspot label shows up is when the hotspot detector is over the the hotspot.

    Can you make like a unitypackage or something with it working?

  • Best to do it the other way around - send me a package with your Managers, your Player prefab, and a sample scene to test things with, along with a breakdown of exactly what behaviour you're looking for.

  • I'm unable to send that because the package over because the project is over 37gb. When i try to export the scene with all the dependencies, it tries to export the whole project.

    The way the behavior is supposed to work, at least the way it was working before was when the player approaches a hotspot, it will show the name of the hotspot thanks to the raycast. Then when the player is next to it, when the hotspot detector is over the hotspot, then the interactions will show up.

    It was meant to be like this;

    https://adventure-creator.fandom.com/wiki/Life_Is_Strange-style_interactions

  • edited March 2022

    Alright I was able to make a scene for you. It's large as i said above, my project is very very large.

    To explain again, if the player approaches a hotspot, i want to see the name of the hotspot so the player can know there's something there. The closer the player gets, the font size of the hotspot goes larger and when the player is next to it; that is the hotspot detector is over the hotspot itself, then the interactions open up. The interaction on nearest script still works fine though.

  • The file needn't be so large - as I said, I should only need the Managers, your Player prefab, and a sample scene.

    More importantly, though, do not post links to AC itself in public threads. I have removed the link above.

  • edited March 2022

    Oooh my bad. Did not occur to me at all.

    https://drive.google.com/file/d/15Fbz6WalycBxOFGuLv1moLkGvduoiROL/view?usp=sharing

    This contains what you asked for.

  • If you are looking to have Hotspot labels show before they are interactive, then you will need to check "Always Show During Gameplay" after all.

    You will need to increase the "10f" above to the maximum square distance they should appear for, e.g. 100f.

    The closer the player gets, the font size of the hotspot goes larger and when the player is next to it

    Menus will not "scale" according to their distance from the Player - you would need to add such functionality through a custom script. The distance between a Hotspot's centre-point and the Player can be gotten with:

    Vector3.Distance (GetComponent<AC.Hotspot> ().GetIconPosition (), AC.KickStarter.player.transform.position);
    
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.