Search Unity

How to make a depth marker?

Discussion in 'General Discussion' started by ChristianJemarcus, Jul 29, 2020.

  1. ChristianJemarcus

    ChristianJemarcus

    Joined:
    Jun 24, 2020
    Posts:
    4
    I am working on a project that involves a submarine and I want to show the player what depth they are at using kind of like a ruler scale that has an indicator or arrow pointing to their depth on the number line. However, anytime I search anything related to "depth" and Unity I just get a bunch of non-related hits. So, can anyone point me towards any tutorials or information that can help explain how to achieve this effect? I've included a mock-up of what I am kind of going for.
     

    Attached Files:

  2. EternalAmbiguity

    EternalAmbiguity

    Joined:
    Dec 27, 2014
    Posts:
    3,144
    If your world is using Unity's coordinate system, can't you just use the Y value (which is height in Unity) times your scale (general 1 unit - 1 meter) compared to some point you've defined as sea level?

    Edit: sorry, I think I totally misunderstood the question.
     
    Last edited: Jul 29, 2020
  3. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,569
    It is just two sprites or two images placed on top of each other.

    The scale image doesn't move, and the "needle" one does. Modify coordinate of the "needle" based on the depth, and that will be it.