Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>sounds like you want to determine which side you see based on the rotation and the perspective angle combined.</p> <p>rotation you already know how to read.</p> <p>and it looks like the perspective angle is based on only a change in x (based on your image)</p> <p>in game terms, this would be like seeing through the eyes of a hero that can only step left and right, but not forwards backwards or turning. Please confirm.</p> <p>if thats the case, i recommend finding the perspective angle with something like this.</p> <p>this is 2d math as if viewing your camera(as hero) and your pic from overhead. and finding the angle between them.</p> <pre><code>//find difference between hero and pic positions (delta means difference or change) var deltaPt:Point = new Point(pic.x - hero.x, pic.y - hero.y); //find angle between hero and pic, then convert to degrees from radians var angle:Number = Math.atan2(deltaPt.y, deltaPt.x) * 180 / Math.PI var testAngle:Number = pic.rotation + angle; trace("angle: "+angle); trace("testAngle: "+testAngle); </code></pre> <p>check if those traces are anywhere near what your expecting to see.</p> <p>perhaps angle needs to be negative instead of positive, or offset by 90º or something (i tend to guess and check this a bit, sorry for the slop)</p> <p>if your hero is also able to rotate... it may get more complicated, or it might just involve adding the hero's rotation to the mix, I haven't thought that part through just yet.</p> <p>once you get it adjusted right it should end in something like this, which I'm sure you already know.</p> <pre><code>if(testAngle &gt; 90){gotoAndStop(2)} else{gotoAndStop(1)}; </code></pre> <p>hope that helps some.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload