Good evening. I have a small problem.
Its essence lies in the fact that when I spawn and turn prop_dynamics on the ground - it turns exactly the way I need to
However, if I spawn prop on the wall - it does not rotate as I need. He turns on the axis z, but when it is against the wall, I need to rotate it along the axis of x. How to turn me:
How to turn should:
How can this be implemented?
On off forum prompted, that should be used
TR_GetPlaneNormal and gave a link to the scalar vector, but I did not understand what I need to do.
Here is my code turn prop_dynamic:
Code:
bool:TurnEntity(client, Float:angle)
{
decl ent, Float:Angles[3], Float:OldAngles[3], Float:normal[3], String:name[64];
ent = GetClientAimTarget(client, false);
if (IsValidEntity(ent))
{
if (CheckEntNotClient(ent))
{
GetEdictClassname(ent, name, sizeof(name));
GetEntPropVector(ent, Prop_Send, "m_angRotation", OldAngles);
Angles[0] = OldAngles[0];
Angles[1] = OldAngles[1] + angle;
Angles[2] = OldAngles[2];
TeleportEntity(ent, NULL_VECTOR, Angles, NULL_VECTOR);
for (new i=1;i<=MaxClients;i++)
{
if (IsClientConnected(i) && !IsClientObserver(i) && IsPlayerAlive(i))
{
if (IsPlayerStuck(i))
{
PrintToChat(client, "\x04[Props]\x03 Невозможно повернуть проп. Кто-то застрянет.");
TurnEntity(client, -45.0);
return false;
}
}
}
return true;
}
}
return false;
}
P.s Help please: I beg really need ...