SetObjectToFaceCords help
#3

I don't know if I've made this function, I highly doubt it, but I also forgot who made it so, I only remember me trying to create it with regular tangents functions only to find out they really weren't really answering to my trigonometry formulas (I even had my math teacher help me out with it at the moment and neither of us could figure it out using the atan provided in PAWN! but I've read somewhere that there was atan2 and answered exactly like I wanted it to answer -- Even one of my exams in university featured a similar problem!)

pawn Код:
stock Float:GetAngleToPoint(Float:fDestX, Float:fDestY, Float:fPointX, Float:fPointY)
    return atan2((fDestY - fPointY), (fDestX - fPointX)) + 90.0;
I can assure you this does work with cow object! I don't know about the others :P


EDIT: Tested it with the shark object, same result as your bigass formula, it is due the GTA SA object rotation, for the shark it will work if instead of summing 180 you sum 90
Reply


Messages In This Thread
SetObjectToFaceCords help - by HenrySunseri - 12.03.2014, 20:51
Re: SetObjectToFaceCords help - by HenrySunseri - 12.03.2014, 21:00
Re: SetObjectToFaceCords help - by CuervO - 12.03.2014, 21:01

Forum Jump:


Users browsing this thread: 2 Guest(s)