View Single Post
Author Message
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 12-15-2010 , 18:51   [SOLVED] Entity size doesn't work
Reply With Quote #1

I don't know why this doesn't works:

PHP Code:
    new iEnt create_entity("info_target")
    
    
entity_set_string(iEntEV_SZ_classname"func_oil_barrel")
    
    
entity_set_origin(iEntvecEnd)
    
entity_set_model(iEntBARREL_MODEL)
    
    
entity_set_int(iEntEV_INT_solidSOLID_BBOX)
    
entity_set_int(iEntEV_INT_movetypeMOVETYPE_TOSS)
    
    
entity_set_float(iEntEV_FL_takedamageDAMAGE_YES)
    
entity_set_float(iEntEV_FL_health100.0)
    
    
entity_set_edict(iEntEV_ENT_euser3iId)
    
    
entity_set_size(iEntBARREL_MINSBARREL_MAXS)
    
    
set_task(0.1"task_SendBeam"iEnt
"task_SendBeam" function:

PHP Code:
public task_SendBeam(iEnt// Code for testing purpose.
{
    if(!
is_valid_ent(iEnt))
        return;
    
    new 
Float:vecOrigin[3], Float:vecMins[3], Float:vecMaxs[3];
    
    
entity_get_vector(iEntEV_VEC_minsvecMins);
    
entity_get_vector(iEntEV_VEC_maxsvecMaxs);
    
entity_get_vector(iEntEV_VEC_originvecOrigin);
    
    
vecMins[0] += vecOrigin[0];
    
vecMins[1] += vecOrigin[1];
    
vecMins[2] += vecOrigin[2];
    
vecMaxs[0] += vecOrigin[0];
    
vecMaxs[1] += vecOrigin[1];
    
vecMaxs[2] += vecOrigin[2];
    
    
DrawLine(vecMaxs[0], vecMaxs[1], vecMaxs[2], vecMins[0], vecMaxs[1], vecMaxs[2])
    
DrawLine(vecMaxs[0], vecMaxs[1], vecMaxs[2], vecMaxs[0], vecMins[1], vecMaxs[2])
    
DrawLine(vecMaxs[0], vecMaxs[1], vecMaxs[2], vecMaxs[0], vecMaxs[1], vecMins[2])
    
DrawLine(vecMins[0], vecMins[1], vecMins[2], vecMaxs[0], vecMins[1], vecMins[2])
    
DrawLine(vecMins[0], vecMins[1], vecMins[2], vecMins[0], vecMaxs[1], vecMins[2])
    
DrawLine(vecMins[0], vecMins[1], vecMins[2], vecMins[0], vecMins[1], vecMaxs[2])
    
DrawLine(vecMins[0], vecMaxs[1], vecMaxs[2], vecMins[0], vecMaxs[1], vecMins[2])
    
DrawLine(vecMins[0], vecMaxs[1], vecMins[2], vecMaxs[0], vecMaxs[1], vecMins[2])
    
DrawLine(vecMaxs[0], vecMaxs[1], vecMins[2], vecMaxs[0], vecMins[1], vecMins[2])
    
DrawLine(vecMaxs[0], vecMins[1], vecMins[2], vecMaxs[0], vecMins[1], vecMaxs[2])
    
DrawLine(vecMaxs[0], vecMins[1], vecMaxs[2], vecMins[0], vecMins[1], vecMaxs[2])
    
DrawLine(vecMins[0], vecMins[1], vecMaxs[2], vecMins[0], vecMaxs[1], vecMaxs[2])
    
    
set_task(0.1"task_SendBeam"iEnt)

The size works fine, but there's something that I don't know why doesn't works correctly.

See this picture: LINK

The size is perfect for the model as you can see.

You can see in the code that I activated the damage for the entity. Supposedly it must show some sparks on the endposition of the bullet.

PHP Code:
public fw_Barrel_TraceAttack(iVictimiAttackerFloat:flDamageFloat:vecDirection[3], iTriDamageType)
{
    new 
szClassname[33]
    
entity_get_string(iVictimEV_SZ_classnameszClassnamecharsmax(szClassname))
    
    if(!
equal(szClassname"func_oil_barrel"))
        return 
HAM_IGNORED
        
    
new Float:vecEndPos[3]
    
get_tr2(iTrTR_vecEndPosvecEndPos)
    
    
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYvecEndPos0)
    
write_byte(TE_SPARKS// TE iId
    
engfunc(EngFunc_WriteCoordvecEndPos[0]) // x
    
engfunc(EngFunc_WriteCoordvecEndPos[1]) // y
    
engfunc(EngFunc_WriteCoordvecEndPos[2]) // z
    
message_end()
    
    return 
HAM_HANDLED

Now see this picture: LINK

It doesn't.

See how my (custom) flashlight ignores the entity: LINK - LINK (It obviously uses traceline's method)

Only when I aim at the center of the entity (and when I fire too) it doesn't ignore it: LINK

Anyone knows why appears this problem?
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross

Last edited by meTaLiCroSS; 12-17-2010 at 11:10.
meTaLiCroSS is offline