Forum rules - please read before posting.

Showing a quest marker on hotspot

edited February 2022 in Technical Q&A

I'd like to show a quest marker that can be seen over obstacles (walls, floors, ceils, etc...) on hotspot so that players know where to go.
What I want to do is like this.

Does AC have any system to implement this?

Comments

  • It depends on exactly when/how you want to show such icons.

    Hotspot icons can be enabled in the Settings Manager - see the Display Hotspot icons setting inside the "Hotspot settings" panel.

    This allows an icon to be displayed either when the Player is within interaction distance of a Hotspot - or at all times.

    If you want such icons to be displayed when the Player is "nearby", i.e. some set distance away, but not necessarily close enough to interact with their associated Hotspots, then you can set this to Custom Script and rely on a script that triggers a Hotspot component's SetIconVisibility function.

    This example script causes Hotspot icons to show when close enough to the camera:

    using UnityEngine;
    using AC;
    
    public class ShowNearbyHotspotIcons : MonoBehaviour
    {
    
        public float maxDistanceFromCamera = 20f;
    
        private void Update ()
        {
            foreach (Hotspot hotspot in KickStarter.stateHandler.Hotspots)
            {
                float distanceFromCamera = (hotspot.GetIconPosition () - Camera.main.transform.position).sqrMagnitude;
                bool isCloseEnough = distanceFromCamera < maxDistanceFromCamera;
                hotspot.SetIconVisibility (isCloseEnough);
            }
        }
    
    }
    
  • Thank you very much! The script you gave me works perfect!

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.