This is more a question for the elite here, like MrM.
My aimbot isn't rotating correctly. Ignoring pitch for now, and focusing only on yaw in the 1st quadrant- this is what I have...
void CVietcongAimbot::Update()
{
VC_LOCALPLAYER* pLocalPlayer = this->GetLocalPlayer();
VC_NETPLAYER* pNetTargetPlayer = this->GetNetTargetPlayer();
if( (this->IsOn()) &&
(NULL != pLocalPlayer) &&
(NULL != pNetTargetPlayer) )
{
float Xdif;
float Zdif;
float Ydif;
float angleR;
//Target player is in 1st quadrant
if(pNetTargetPlayer->pos.x > pLocalPlayer->pos.x && pNetTargetPlayer->pos.z > pLocalPlayer->pos.z)
{
Xdif = pNetTargetPlayer->pos.x - pLocalPlayer->pos.x;
Zdif = pNetTargetPlayer->pos.z - pLocalPlayer->pos.z;
angleR = atan(Zdif / Xdif);
pLocalPlayer->fYaw = angleR;
}
... other quadrants removed, only focusing on first for now.
Vietcong stores rotation values as floats in radians IE 2*PI = 1 full revolution. No need to convert back and forth from degrees etc.
VietcongAimbot.Update() is called from within DrawIndexedPrimitive(); but I've also tried in GetTransform() and SetTransform()...
I can not see anything wrong with the maths either, yet it doesn't work.
Could someone shed some light on this?
Also, Medic- did you reverse the VC 3D vector to be:
struct c_Vector3 { float x; float z; float y; };
Thanks