Flying arrow pointing towards hotspot

  • I'm creating an arrow (hotspot[arrow]) that points to a hotspot (hotspot[cross]). Right now, using the code below, it looks like this:

    The arrow should always be pointing to the center of the cross, but it doesn't. I guess I'm over complicating things in my code. So, do you have any suggestions how to approach this?

    Thanks!

  • Hi,
    can you share the final code with us?


    Sure!

    I added this JS function to the page krpano is embedded on:

    Code
    function bearing(hlookat,vlookat,ath,atv) {
    	const phi_1 = vlookat * ( Math.PI / 180 );
    	const phi_2 = atv * ( Math.PI / 180 );
    	const delta_lambda = (ath - hlookat) * ( Math.PI / 180 );
    	const x = Math.cos(phi_1) * Math.sin(phi_2) - Math.sin(phi_1) * Math.cos(phi_2) * Math.cos(delta_lambda);
    	const y = Math.sin(delta_lambda) * Math.cos(phi_2);
    	const theta = Math.atan2(y, x);
    	const bearing = theta * (180/Math.PI);
    	return -bearing;
    }

    ... and accessed the function in krpano this way:

    Cheers

  • thanks *thumbsup*
    This code I made in krpano without JS:

  • Hello San7!!! How your code works? because I tried it but nothing.

    Hi, this is working

Jetzt mitmachen!

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