Raised This Month: $51 Target: $400
 12% 

Rotate prop_dynamic


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CAH4EzZz
New Member
Join Date: Dec 2010
Old 12-14-2010 , 10:14   Rotate prop_dynamic
Reply With Quote #1

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 ...
CAH4EzZz is offline
miniman
Senior Member
Join Date: Aug 2009
Location: Israel
Old 12-14-2010 , 10:46   Re: Rotate prop_dynamic
Reply With Quote #2

its really isnt that hard:
get twice the "m_angRotation" once when its on the floor and once when its on the wall compare between these 2 vectors some axis will change by 90 and after u have got what changes make the script and check if its changed by 90 to see if its on the wall
miniman is offline
CAH4EzZz
New Member
Join Date: Dec 2010
Old 12-14-2010 , 14:56   Re: Rotate prop_dynamic
Reply With Quote #3

Thanks but I need that would subject was rotated by 45 degrees or is it the same?
CAH4EzZz is offline
CAH4EzZz
New Member
Join Date: Dec 2010
Old 12-15-2010 , 06:02   Re: Rotate prop_dynamic
Reply With Quote #4

Yes, I have to get the angles when it is on the wall
CAH4EzZz is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:21.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode