AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Angle of any surface normal (https://forums.alliedmods.net/showthread.php?t=155610)

Mini_Midget 04-24-2011 11:17

Angle of any surface normal
 
Been trying to work out this problem the whole day by myself and finally decided to post here.

I can find the normal of any plane but what I want to do with the plane is place my ent on the plane as well have its angle oriented properly.

I have absolutely no idea why this doesn't work.

Any help will be appreciated! Thanks

PHP Code:

public Forward_CmdStart(iduc_handleseed)
{
    if(!
is_user_alive(id))
        return;

    static 
iButtoniButton get_ucuc_handleUC_Buttons );
    static 
oldButton oldButton pev(idpev_oldbuttons);
    
    static 
Float:vecOrigin], Float:vecViewOfs];
    
pevidpev_originvecOrigin );
    
pevidpev_view_ofsvecViewOfs );
    
xs_vec_addvecOriginvecViewOfsvecOrigin );

    static 
Float:vecAngle];
    
pevidpev_v_anglevecAngle );
    
engfuncEngFunc_MakeVectorsvecAngle );
    
global_getglb_v_forwardvecAngle );
    
xs_vec_mul_scalarvecAngle9999.0vecAngle );

    static 
Float:vecAimOrigin];
    
xs_vec_addvecOriginvecAnglevecAimOrigin );

    
engfuncEngFunc_TraceLinevecOriginvecAimOriginDONT_IGNORE_MONSTERSid);
    
    
get_tr20TR_vecEndPosvecAimOrigin );

    static 
Float:vecNormal];
    
get_tr20TR_vecPlaneNormalvecNormal );

    
// xs_vec_mul_scalar(vecNormal, 50.0, vecNormal);

    
static FloatendTraceNormal[3];
    
xs_vec_add(vecAimOriginvecNormalendTraceNormal)
    
    if( !(
iButton IN_USE) && (oldButton IN_USE))     
    {
        static 
iEntiEnt create_entity("info_target");
        
        
entity_set_string(iEntEV_SZ_classnameg_classname);
        
        
entity_set_model(iEntg_Model);
        
        new 
FloatMinBox[3] = { -25.0, -25.00.0 };
        new 
FloatMaxBox[3] = { 25.025.055.0 };

        
entity_set_size(iEntMinBoxMaxBox);

        
entity_set_origin(iEntendTraceNormal);

        
vector_to_angle(vecNormalvecNormal)

        
entity_set_vector(iEntEV_VEC_anglesvecNormal);

        
entity_set_int(iEntEV_INT_movetypeMOVETYPE_FLY);
        
entity_set_int(iEntEV_INT_solidSOLID_BBOX);
        
        
entity_set_edict(iEntSPORE_BUILDERid); 
        
entity_set_int(iEntEV_INT_teamget_user_team(id));
        
        
// drop_to_floor(iEnt);

        
entity_set_float(iEntEV_FL_nextthinkget_gametime() + 0.1);
        
        
g_EntSpawn[iEnt] = true;
    }




All times are GMT -4. The time now is 20:03.

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