Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
|
12-15-2010
, 18:51
[SOLVED] Entity size doesn't work
|
#1
|
I don't know why this doesn't works:
PHP Code:
new iEnt = create_entity("info_target") entity_set_string(iEnt, EV_SZ_classname, "func_oil_barrel") entity_set_origin(iEnt, vecEnd) entity_set_model(iEnt, BARREL_MODEL) entity_set_int(iEnt, EV_INT_solid, SOLID_BBOX) entity_set_int(iEnt, EV_INT_movetype, MOVETYPE_TOSS) entity_set_float(iEnt, EV_FL_takedamage, DAMAGE_YES) entity_set_float(iEnt, EV_FL_health, 100.0) entity_set_edict(iEnt, EV_ENT_euser3, iId) entity_set_size(iEnt, BARREL_MINS, BARREL_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(iEnt, EV_VEC_mins, vecMins); entity_get_vector(iEnt, EV_VEC_maxs, vecMaxs); entity_get_vector(iEnt, EV_VEC_origin, vecOrigin); 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(iVictim, iAttacker, Float:flDamage, Float:vecDirection[3], iTr, iDamageType) { new szClassname[33] entity_get_string(iVictim, EV_SZ_classname, szClassname, charsmax(szClassname)) if(!equal(szClassname, "func_oil_barrel")) return HAM_IGNORED new Float:vecEndPos[3] get_tr2(iTr, TR_vecEndPos, vecEndPos) engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vecEndPos, 0) write_byte(TE_SPARKS) // TE iId engfunc(EngFunc_WriteCoord, vecEndPos[0]) // x engfunc(EngFunc_WriteCoord, vecEndPos[1]) // y engfunc(EngFunc_WriteCoord, vecEndPos[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
You're right Metalicross
|
Last edited by meTaLiCroSS; 12-17-2010 at 11:10.
|
|