Raised This Month: $ Target: $400
 0% 

Entity collision size


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
loko10
Junior Member
Join Date: Oct 2011
Old 02-01-2016 , 18:45   Entity collision size
Reply With Quote #1

Hello. I've been having a problem that I can't solve... The entity's collision size with other entities is fine, but the collision with the world is not. I'll show two different images that will let you understand my problem.

The green line is the "good" collision size. The red line is the "bad" one, but it only happens with a corner of the entity as you can see. Players and other entities collide with the green size, while world and brushes with the red one. Sorry for my bad english, hope you can help me .

PD: I've been giving velocity to the entity so it can move around, if that helps...

Spoiler


PHP Code:
CreateBottle( const Float:flOrigin] = { 0.00.00.0 }, const Float:flAngles] = { 0.00.00.0 } )
{
    static 
iEntiEnt create_entity"info_target" );
    
    if( !
iEnt ) return 0;
    
    
entity_set_stringiEntEV_SZ_classnameg_szBottleClassname );
    
entity_set_modeliEntg_szBottleModel );
    
    
entity_set_sizeiEntFloat:{-8.0,-8.0,0.0}, Float:{8.0,8.0,16.0} );
    
    
entity_set_intiEntEV_INT_movetypeMOVETYPE_PUSHSTEP );
    
entity_set_intiEntEV_INT_solidSOLID_BBOX );
    
    
entity_set_originiEntflOrigin );
    
    
entity_set_floatiEntEV_FL_takedamage1.0 );
    
entity_set_floatiEntEV_FL_health100.0 );
    
    
entity_set_vectoriEntEV_VEC_anglesflAngles );
    
    return 
iEnt;


Last edited by loko10; 02-01-2016 at 18:48.
loko10 is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 02-03-2016 , 11:38   Re: Entity collision size
Reply With Quote #2

Quote:
Originally Posted by loko10 View Post
PHP Code:
    entity_set_sizeiEntFloat:{-8.0,-8.0,0.0}, Float:{8.0,8.0,16.0} ); 
That's probably why. Don't mess with size if you don't know what you're doing.
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
loko10
Junior Member
Join Date: Oct 2011
Old 02-03-2016 , 13:33   Re: Entity collision size
Reply With Quote #3

Quote:
Originally Posted by georgik57 View Post
That's probably why. Don't mess with size if you don't know what you're doing.
You aren't helping at all. The size is fine when other entities collide with it. Re-read the thread.
loko10 is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 02-03-2016 , 14:35   Re: Entity collision size
Reply With Quote #4

Quote:
Originally Posted by loko10 View Post
You aren't helping at all. The size is fine when other entities collide with it. Re-read the thread.
Try without it.
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
loko10
Junior Member
Join Date: Oct 2011
Old 02-03-2016 , 15:22   Re: Entity collision size
Reply With Quote #5

Quote:
Originally Posted by georgik57 View Post
Try without it.
Without size, the entity would not collide with players nor with the world...

I guess you are not understanding. The player collides with the entity's real size ( the green one ) and the world collides with some strange size ( the red one ). I've been searching a lot but I can't find anything related to my problem.

I've tried changing the way I create the entity ( movetype or solid first, origin at the end, etc ) and it didn't work.

Last edited by loko10; 02-03-2016 at 15:28.
loko10 is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 02-04-2016 , 07:33   Re: Entity collision size
Reply With Quote #6

I think I've come across your problem before. Try setting the solid type before the model.
Also, the entity will collide with everything even without the size set as long as it's solid.
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
loko10
Junior Member
Join Date: Oct 2011
Old 02-04-2016 , 16:26   Re: Entity collision size
Reply With Quote #7

Quote:
Originally Posted by georgik57 View Post
I think I've come across your problem before. Try setting the solid type before the model.
Also, the entity will collide with everything even without the size set as long as it's solid.
Well, without size it actually collides but only the center of the entity. And I did set the solid type before the model without results :/ Any other idea?

I'll give more examples. I'll draw the size of the entity with a function, and print it's information.

PHP Code:
DrawBox( const iEnt, const iDelay )
{
    static 
Float:flOrigin], Float:flMins], Float:flMaxs];
    
    
entity_get_vectoriEntEV_VEC_originflOrigin );
    
    
entity_get_vectoriEntEV_VEC_minsflMins );
    
entity_get_vectoriEntEV_VEC_maxsflMaxs );
    
    
message_beginMSG_BROADCASTSVC_TEMPENTITY );
    
write_byteTE_BOX );
    
engfuncEngFunc_WriteCoordflOrigin] + flMins] );
    
engfuncEngFunc_WriteCoordflOrigin] + flMins] );
    
engfuncEngFunc_WriteCoordflOrigin] + flMins] );
    
engfuncEngFunc_WriteCoordflOrigin] + flMaxs] );
    
engfuncEngFunc_WriteCoordflOrigin] + flMaxs] );
    
engfuncEngFunc_WriteCoordflOrigin] + flMaxs] );
    
write_shortiDelay );
    
write_byte250 );
    
write_byte);
    
write_byte);
    
message_end( );

Results

Spoiler


As you can see, the entity should have fallen but it didn't.

Last edited by loko10; 02-04-2016 at 17:08.
loko10 is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 02-04-2016 , 19:21   Re: Entity collision size
Reply With Quote #8

Try other movetypes.
Quote:
#define MOVETYPE_PUSHSTEP 13 // BSP model that needs physics/world collisions (uses nearest hull for world collision)
As far as I know, BSP model is brush(map) model. Your model is studio.
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
wickedd
Veteran Member
Join Date: Nov 2009
Old 02-04-2016 , 19:32   Re: Entity collision size
Reply With Quote #9

Quote:
Originally Posted by loko10 View Post
As you can see, the entity should have fallen but it didn't.
drop_to_floor()
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
loko10
Junior Member
Join Date: Oct 2011
Old 02-04-2016 , 19:39   Re: Entity collision size
Reply With Quote #10

Quote:
Originally Posted by georgik57 View Post
Try other movetypes.

As far as I know, BSP model is brush(map) model. Your model is studio.
I've tried every movetype with gravity ( bounce, toss, etc ). I'll try them again but I guess it will give the same result

@wickedd: ? it should have fallen by gravity.

EDIT: No results, I tested with MOVETYPE_BOUNCE, MOVETYPE_TOSS, MOVETYPE_BOUNCEMISSILE, MOVETYPE_FLY, MOVETYPE_FLYMISSILE. I'm pretty sure server would crash with MOVETYPE_PUSH, and MOVETYPE_STEP makes the model disappear.

I've been using MOVETYPE_PUSHSTEP because its the one that gives me the best results :/

This is the code I actually have. If you see something wrong please tell me. Players collide with the "red box" in the last picture I uploaded, but for some reasons the size is a bit bigger when it collides with the world.

PHP Code:
CreateProp( const iPropFloat:flOrigin] = { 0.00.00.0 }, const Float:flAngles] = { 0.00.00.0 } )
{
    if( 
g_iTotalProps <= iProp ) return 0;
    
    static 
iEntFloat:flMaxs], Float:flMins];
    
    do
    {
        
iEnt create_entity"info_target" );
    }
    while ( !
is_valid_entiEnt ) );
    
    
entity_set_originiEntflOrigin );
    
    
entity_set_stringiEntEV_SZ_classnameg_szPropClassname );
    
    
entity_set_intiEntEV_INT_solidSOLID_BBOX );
    
entity_set_intiEntEV_INT_movetypeMOVETYPE_PUSHSTEP );
    
    
entity_set_modeliEntg_ePropsiProp ][ Prop_Model ] );
    
    
flMins] = g_ePropsiProp ][ Prop_Size ][ ],
    
flMins] = g_ePropsiProp ][ Prop_Size ][ ];
    
flMins] = g_ePropsiProp ][ Prop_Size ][ ];
    
flMaxs] = g_ePropsiProp ][ Prop_Size ][ ];
    
flMaxs] = g_ePropsiProp ][ Prop_Size ][ ];
    
flMaxs] = g_ePropsiProp ][ Prop_Size ][ ];
    
    
entity_set_sizeiEntflMinsflMaxs );
    
    
entity_set_vectoriEntEV_VEC_anglesflAngles );
    
    
drop_to_flooriEnt );
    
    return 
iEnt;


Last edited by loko10; 02-04-2016 at 20:00.
loko10 is offline
Reply



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 09:20.


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