Raised This Month: $ Target: $400
 0% 

Creating truly solid entity


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
summodder
Junior Member
Join Date: Sep 2007
Old 09-22-2007 , 00:13   Re: Creating truly solid entity
Reply With Quote #3

The problem appears to be with the entity size or solid state. I can break my boxes but i'm unable to shoot or be blocked by them I've revised some of my code and got this:
Quote:
new Float:playerOrigin[3]
entity_get_vector(id, EV_VEC_origin, playerOrigin)

new Float:mins[3], Float:maxs[3]

mins[0] = zminz[0]
mins[1] = zminz[1]
mins[2] = zminz[2]

maxs[0] = zmaxz[0]
maxs[1] = zmaxz[1]
maxs[2] = zmaxz[2]

//this part from sentry guns by jhhg

new Float:vNewOrigin[3]
new Float:vTraceDirection[3]
new Float:vTraceEnd[3]
new Float:vTraceResult[3]
velocity_by_aim(id, 50, vTraceDirection) // get a velocity in the directino player is aiming, with a multiplier of 64...
vTraceEnd[0] = vTraceDirection[0] + playerOrigin[0] // find the new max end position
vTraceEnd[1] = vTraceDirection[1] + playerOrigin[1]
vTraceEnd[2] = vTraceDirection[2] + playerOrigin[2]
trace_line(id, playerOrigin, vTraceEnd, vTraceResult) // trace, something can be in the way, use hitpoint from vTraceResult as new origin, if nothing's in the way it should be same as vTraceEnd
vNewOrigin[0] = vTraceResult[0]// just copy the new result position to new origin
vNewOrigin[1] = vTraceResult[1]// just copy the new result position to new origin
vNewOrigin[2] = playerOrigin[2] // always build in the same height as player.

new EntBlock = create_entity("func_breakable")

DispatchKeyValue(EntBlock,"material","2")
DispatchKeyValue(EntBlock,"health","30")

DispatchSpawn(EntBlock)

entity_set_string(EntBlock,EV_SZ_classname,"f unc_cube")
entity_set_size(EntBlock,mins,maxs)

engfunc(EngFunc_SetSize, EntBlock, mins, maxs);
set_pev(EntBlock, pev_mins, mins);
set_pev(EntBlock, pev_maxs, maxs );
set_pev(EntBlock, pev_absmin, mins);
set_pev(EntBlock, pev_absmax, maxs );

entity_set_model(EntBlock,"models/pac_cube.mdl")
entity_set_int(EntBlock, EV_INT_movetype,MOVETYPE_NONE)
entity_set_int(EntBlock,EV_INT_solid,SOLID_BS P)
entity_set_origin(EntBlock,vNewOrigin)
entity_set_edict(EntBlock,EV_ENT_owner,id)
summodder is offline
 



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 16:14.


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