AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Entity within entity touching (https://forums.alliedmods.net/showthread.php?t=243432)

GuskiS 07-04-2014 11:22

Entity within entity touching
 
How does this happen? One entity is solid_trigger, other solid_bbox. Trigger one is large cube. What I need is that bbox one can't leave this trigger area. So I was thinking of touch, when does touch triggers - when it touches the sides or all the time when inside?

aron9forever 07-05-2014 09:25

Re: Entity within entity touching
 
in theory, all the time inside
an entity is not a box, it's a full cube

r0ck 07-06-2014 00:58

Re: Entity within entity touching
 
Can you explain a bit more ??
Not able to understand you what exactly you are trying to do..

BTW this code detects if Entity1's origin is inside the Entity2 Cube, hopefully this helps you

PHP Code:

bool:IsEntityInsideEntity( const iEntity1, const iEntity2 
{
    new 
Float:vOrigin], Float:vAbsMin], Float:vAbsMax];         
    
peviEntity1pev_originvOrigin );  
    
peviEntity2pev_absminvAbsMin );     
    
peviEntity2pev_absmaxvAbsMax );         
    
    if( ( 
vAbsMin] <= vOrigin] <= vAbsMax] ) &&  ( vAbsMin] <= vOrigin] <= vAbsMax] ) && ( vAbsMin] <= vOrigin] <= vAbsMax] ) )
        return 
true
    
    return 
false;



klippy 07-06-2014 07:36

Re: Entity within entity touching
 
I think he is trying to make a solid entity not be able to leave a trigger entity. So he was asking if touch forward between these 2 entities is called every frame while solid entity is inside trigger one, or is it just called when they collide their bounding box edges.
I guess it is just on edges, because this is the SOLID_TRIGGER description:
Code:

#define        SOLID_TRIGGER                1                /* touch on edge, but not blocking */
So, you may detect their touch and just put your solid entity inside trigger one again. :)
Although you could test it by moving your entity inside a trigger entity and print out a message on every touch forward call, then move it in a way that only their edges will be touching.

GuskiS 07-06-2014 09:18

Re: Entity within entity touching
 
Quote:

Originally Posted by KliPPy (Post 2162830)
I think he is trying to make a solid entity not be able to leave a trigger entity. So he was asking if touch forward between these 2 entities is called every frame while solid entity is inside trigger one, or is it just called when they collide their bounding box edges.

Bingo :D

Thanks for answer, will test it. I just wanted to know more before starting to work on.


All times are GMT -4. The time now is 21:14.

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