PDA

View Full Version : TeleportEntity Problem (Angle)


Razmo51
02-18-2012, 14:51
Hello

How can I force a player to look at a other player ?

I try this:


new Float:Pos1[3];
new Float:Pos2[3];
new Float:vec[3];
GetEntPropVector(client1, Prop_Send, "m_angRotation", Pos1);
GetEntPropVector(client2, Prop_Send, "m_angRotation", Pos2);
MakeVectorFromPoints(Pos1, Pos2, vec);
TeleportEntity(client1,NULL_VECTOR,vec,NULL_V ECTOR);
// here the client1 must look at client2

Impact123
02-18-2012, 15:13
Look here (http://forums.alliedmods.net/showthread.php?t=175658), use the search next time.

Yours sincerely
Impact

Razmo51
02-18-2012, 22:39
doesn't work for my request, I want to teleport both players and to 'face' each players to the other

blodia
02-19-2012, 15:03
"m_angRotation" is an angle vector not a position vector.
after making a vector between the players position you need to make a copy and negate it then turn them both into angle vectors.

Razmo51
02-19-2012, 16:34
"m_angRotation" is an angle vector not a position vector.
after making a vector between the players position you need to make a copy and negate it then turn them both into angle vectors.

Can you convert your thing into a script xD I don't understand ^^

blodia
02-19-2012, 17:16
you won't learn anything if i do all the work for you.
use "m_vecOrigin" instead of "m_angRotation" in your snippet.
use GetVectorAngles (http://docs.sourcemod.net/api/index.php?fastload=show&id=552&) and NegateVector (http://docs.sourcemod.net/api/index.php?fastload=show&id=557&) for what i said in my previous post.
vec will give you the vector from client1 to client2 but you need another one for client2 to client1 which is the same as negating vec, thats why you need a copy.

Razmo51
02-20-2012, 10:14
Thanks for help ^^