Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- -----------------------------------------
- * Game hacking QTS ( Quickie Tip Series )
- * no. 13 - Calculate closest player to your crosshair
- -----------------------------------------
- * Author: SEGnosis - GHAnon.net
- * Thanks to:
- * bitterbanana - No known site
- * Drunken Cheetah - No known site
- * fatboy88 - No known site
- * Geek4Ever - No known site
- * learn_more - www.uc-forum.com
- * Novocaine - http://ilsken.net/blog/?page_id=64
- * Philly0494 - No known site
- * Roverturbo - www.uc-forum.com
- * SilentKarma - www.halocoders.com - offline
- * Strife - www.uc-forum.com
- * Wieter20 - No known site
- */
- //------------------------------------//
- float GetAngleDistanceFromYaw( float fYaw, FVect3 vPos, FVect3 vTarget )
- {
- FVect2 vDist = { vPos.x - vTarget.x, vPos.z - vTarget.z }; // Get distance total of you and your target
- FView vView; // pitch and yaw float struct
- float fHypot = VectToHypot( vDist ) + 0.000001f;
- /*
- inline float VectToHypot( FVect2 vPos )
- {
- return sqrt( vPos.x * vPos.x + vPos.y * vPos.y );
- }
- */
- vView.yaw = acos( ( vDist.y + 0.000001f ) / fHypot ); // Get radian from cosine of you and your target
- if( vDist.x < 0 && vDist.y < 0 || vDist.x < 0 && vDist.y > 0 ) // add based on quadrent
- vView.yaw = ( PI - vView.yaw );
- else
- vView.yaw = ( PI + vView.yaw );
- return fabsf( fYaw - vView.yaw ); // return absolute distance from crosshair
- }
- //------------------------------------//
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement