View Single Post
Kinsi
Senior Member
Join Date: Apr 2013
Old 03-24-2014 , 13:39   Re: Rotating/modifying angles
Reply With Quote #8

Turns out that wasnt actually the solution to the problem, or maybe i just messed up:

http://steamcommunity.com/sharedfile.../?id=241836714

the line is always facing into that direction, no matter how the chair is roated

PHP Code:
        decl Float:Origin[3];
        
decl Float:Rotation_[3];
        
decl Float:Rotation[3];
        
        
GetEntPropVector(chairProp_Send"m_vecOrigin"Origin);
        
GetEntPropVector(chairProp_Send"m_angRotation"Rotation_);
        
        
GetAngleVectors(Rotation_NULL_VECTORNULL_VECTORRotation);
        
        
Rotation[0] *= -1.0;
        
Rotation[1] *= -1.0;
        
Rotation[2] *= -1.0;
        
        new 
Handle:trace TR_TraceRayFilterEx(OriginRotationMASK_SOLID_BRUSHONLYRayType_InfiniteTraceEntityFilter);
        
        if(
trace != INVALID_HANDLE && TR_DidHit(trace))
        {
            
decl Float:pos[3];
            
TR_GetEndPosition(postrace);
            new 
Float:Distance GetVectorDistance(Originpos);
            
            new 
Color[4] = {25500200};
            
            if(
Distance >= 19.65 && Distance <= 19.8)
            {
                
Color = {02550200};
            }
            
            
TE_SetupBeamPoints(OriginposBeamModelIndex0000.56.06.010.0Color10);
            
TE_SendToAll();
            
            
PrintToChatAll("Trace did hit! Ang: %.2f %.2f %.2f | Dist: %.2f"Rotation[0], Rotation[1], Rotation[2], Distance);
        }
        else
        {
            
PrintToChatAll("Trace didnt hit");
        }
        
CleanCloseHandle(trace); 
Edit: ignore me, forgot to convert the vector back to angles. Thank you very much mate!

Last edited by Kinsi; 03-24-2014 at 13:41.
Kinsi is offline