wanna get first character of hotspot name

  • Hello everyone,

    I wanted to change opacity of hotspots that are near the center of the view.
    it worked thanks to Klaus code.

    But I have hotspots and 3d arrows in the same scene.
    I cannot keep the arrows opacity.

    I want to change alpha of the hotspot that I have created, not the arrows'.

    Hotspot names are like these: "h1", "h2", .....

    So I tried to have condition to check it is the hotspot or arrow.
    for that, I am using string plugin to find the character "h" from each hotspot name to check if it is hotspot I created or arrow

    This is the part of the code:

    The condition (destVar == 0 ) is never true.
    Please, help me

    It would be great If I get solution.
    Thanks a lot,
    Mudin

    Einmal editiert, zuletzt von Mudin (30. März 2016 um 03:58)

  • Thanks for your answer.


    But I cannot solve the problem.

    I guess I have very tiny issue that I cannot see.

    this is updated code:

    The 'message' textfield shows nothing

  • try this code:

  • try this code:

    Thanks!

    I actually gave up with this method.
    it is very slow when there are many hotspots.
    is there any faster way to show hotspots in touchsceen devices when look closer?
    I will appreciate any help or suggestion

    Best regards,
    Mudin

  • Instead of brute-forcing it by cycling through every hotspot, you could use a more targeted approach.

    1.
    First of all, you don't want to even consider other hotspots, that is just a waste of time. Instead, when the scene is done, you could build an array of all the hotspots you need. You only have to do this once per scene and it would resemble the function that you are using now, but instead of setting the alpha, you would put the hotspot into an array.

    Now you only have to run through the hotspots that you know you actually could need, but this still is far from optimal. Perhaps this is all you really need, but there is something else you could then do.

    2.
    To really optimize this, you should consider sorting your data in such a manner that you can easily exclude hotspots that are, at that point, not interesting. This can be done in variety of ways, but I would probably index the array by ath values. This means that you don't have to process any hotspot that are behind you or just to far from the center. (this implementation is edging towards a bit more advanched data-mangling and perhaps isn't necessary for your purposes)

    3.
    Lastly, I would suggest implementing most of it in Javascript, not a pure KRpano action. There is nothing wrong with scripting KRpano actions, but is just is another abstraction layer which by default is a bit slower than doing it 1 level up in javascript. The calls you have to make to KRpano won't be much slower themselves I believe.

    If there is something here that you would like to try, but don't really know how to set up, I'd be happy to try something.

  • Thank you very much for your suggestions and opinions!

    That time, it was so slow,so I gave up with doing this feature in my project.
    I have just seen this post and ur reply.
    And I think I was so silly to try to use actions instead of JavaScript.
    I already have array of all real hotspots (not arrows) in DB and json data.

    Now also I need to find the nearest hotspot to the center when users zoom in to open next scene.

    I will try what you suggested!

    Thanks a lot *smile*

    Best regards,

    Mudin

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!