Visibility of hotspots in a 3d model

  • Hi everybody
    My tour consists of one scene in which there is a 3d model . There are about thirty hotspots in this 3D model. The problem is that all these hotspots are visible at the same time, but I wanted the visibility of the hotspot to depend on the current position of the camera in the 3d model.
    For example, so that the hotspot is visible only at a distance of three meters from it, if the distance is greater, then it is not visible
    Or prescribe hotspots visibility only in certain planes of the 3d model. Do you have any ideas?
    Best regards, Nikolai

  • You can calculate the distance between the hotspot location and the current view.

    From:

    https://www.omnicalculator.com/math/3d-distance
    ---
    What is the 3D distance formula?
    To find the distance between two points in a three-dimensional coordinate system, you need to apply the following formula:

    D = √[(x2 - x1)² + (y2 - y1)² +(z2 - z1)²]

    where:

    D is the distance between two points;
    (x1, y1, z1) are the coordinates of the first point; and
    (x2, y2, z2) are the coordinates of the second point.
    ---


    So all 1 values would be the tx/ty/tz of the view
    and all 2 values would be the tx/ty/tz of the hotspot.

    And then you show/hide the hotspot based on the calculated value of D


    Here is some code I use:

    You can use

    Code
    set(d, calc(getdistancebetweenpoints (x1, y1, z1, x2, y2, z2))) to get the distance

    and then

    Code
    if (d LT 3, show(), hide());

    Kristof

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!