Hello guys
Trying to solve an issue where I can't exactly adjust an entity angle direction to my position.
You can see this drawing skills of mine
to show you what I mean
I found a snippet in the modders community to adjust the entity angle to always face my direction but not when it comes to height difference
PHP Code:
// client
float client_pos[3];
GetClientAbsOrigin(client, client_pos);
// pet
float pet_ang[3], pet_pos[3];
GetEntPropVector(entity, Prop_Data, "m_vecOrigin", pet_pos);
GetEntPropVector(entity, Prop_Data, "m_angRotation", pet_ang);
// adjust pet direction to my position
float distX = client_pos[0] - pet_pos[0];
float distY = client_pos[1] - pet_pos[1];
pet_ang[1] = (ArcTangent2(distY, distX) * 180) / 3.14;
Video to show you my issue - YouTube
I Uploaded a test version, using TR_DidHit() to detect ground and attach it to it. You will notice some issues when going to different level surface.
Requires: Left4Dhooks
Video showing the test version -
YouTube
If anyone has a solution, that would be great
Thanks