PDA

View Full Version : Make a model face a player?


noodleboy347
01-07-2012, 00:12
I need to make a model face a player using a player's position and the model's position and changing the angles. How can I turn it to face me using TeleportEntity?

Impact123
01-07-2012, 01:39
Because you were to lazy to post you code, i am too :)
In theory you can do something like this.

new target = GetClientAimTarget(client, false);

if(target >0 && IsClientConnected(target))
{
new Float:ModelAng[3], Float:ModelPos[3], Float:ClientAng[3];
GetClientEyeAngles(target, ModelAng);
GetClientAbsOrigin(target, ModelPos);
GetClientEyeAngles(client, ClientAng);

ModelAng[1] = ClientAng[1] + 180;

TeleportEntity(target, ModelPos, ModelAng, NULL_VECTOR);
}

Since you are working with a model, you might use other ways.

Yours sincerely
Impact

noodleboy347
01-07-2012, 01:49
Heheh I really had no code worthy of posting, other than failed attempts. Thank you so much!

noodleboy347
01-07-2012, 19:32
Any way I could do it without having to look at the model?