Hittest krpano hotspot with another Sprite instance

  • Hi everybody,

    I am loading a krpano panorama into a swf container where I have a custom cursor (Sprite) that's moved around without the mouse. Because of this I cannot listen to any mouse even and for a hotspot click I need to check for hitTest between the custom cursor and a krpano hotspot. Is it possible to do this? There is no problem to retrieve the hotspot but I have no idea how to detect the collision between the hotspot and the sprite.

  • Thanks for your reply, Andrey!

    I should have mentioned that is exactly how I am doing it right now:

    Code
    atv = _krpano.get("hotspot[hotspotdisplay].atv");
    ath = _krpano.get("hotspot[hotspotdisplay].ath");
    coords = String(_krpano.get("spheretoscreen("+ath +","+atv +")"));
    split = coords.split(",");
    _hotspotDisplayPos.x = split[0];
    _hotspotDisplayPos.y = split[1];


    However, I have quite a bunch of hotspots and this script has to run on every render (onviewchanged) to obtain the updated coordinates. I was wondering whether there is some more performance friendly way to do this.

    EDIT: Or do you mean it backwards: check the sprite's spehere position and compare? Maybe that'd be better indeed. But in that case the question is how to compare the position / width / height of the objects? (as of course I cannot compare just two points but all the area)

  • Hi,

    The way you are referring to doesn't work in a loaded pano (or at least I cannot make it work). The above code works flawlessly and it was the only way I could achieve this.

Participate now!

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