Question for Bill Stanbrook (or maybe others)
Blitz3D Forums/Blitz3D Beginners Area/Question for Bill Stanbrook (or maybe others)
| ||
Regarding Bill's YawTopEntity code here: http://www.blitzbasic.com/codearcs/codearcs.php?code=2258 I was curious to how the Yaw'ing "knows" which way to rotate is gonna be the fastest, for example (okay, bear with my crappy ascii art) The line representrs, say a homing missile, whilst the 'T' is the target... / T assuming the / missile is facing up-right, how would it know turning 45 degrees clockwise is gonna be 'better' than turning 315 degrees anticlockwise? Sure 45 < 315, but entity yaw values don't go from 0-360. This is part of why I wanted to pursue a means of identifying entities' facing angles in 0-360 format |
| ||
The command Deltayaw does all the real work here. Given a source entity and destination entity it returns the yaw angle , between -180 and 180 degrees, to the target. The SGN of this angle is effectively the direction of the turn. Once you get used to it, the range -180 to 180 is much more useful than 0-360. |
| ||
Ahah right, so you get esswentially the 'direction' AND magnitude of the angle difference in one go :) Thanks, Stevie. |