Raised This Month: $12 Target: $400
 3% 

[HELP] Stock to check if 2 entities are touching using bounds/position/angles


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
scorpius2k1
Senior Member
Join Date: Feb 2016
Old 07-03-2022 , 14:04   [HELP] Stock to check if 2 entities are touching using bounds/position/angles
Reply With Quote #1

I am aware there are SDK_Hooks that can do this "OnStartTouch", etc, but I am needing a separate stock that can basically do the same thing for entities that do not have those outputs. When two entities are touching the stock takes consideration of bounds/position/angles to appropriately calculate if they are intersecting X, Y, Z. Essentially it should work similarly to how the engine detects collisions using bounding boxes.

I have been able to get it to work with the bounds + position, but have not been able to combine that with the angle. I need help figuring out how to translate the stock below to do the aforementioned. I am sure this would be fairly easy for those with a deeper understanding of vectors, angles, etc.

Any help is greatly appreciated and hopefully the solution will be useful to others as well.

Thanks!

PHP Code:
stock bool AreEntitiesTouching(int entity_aint entity_b) {
    
float vecm_a[3], vecm_b[3]; // BOUNDS
    
float vec_a[3], vec_b[3]; // POSITION 
    
float ang_a[3], ang_b[3]; // ANGLE

    
GetEntPropVector(entity_aProp_Data"m_vecMaxs"vecm_a);
    
GetEntPropVector(entity_aProp_Data"m_vecOrigin"vec_a);
    
GetEntPropVector(entity_aProp_Data"m_angRotation"ang_a);

    
GetEntPropVector(entity_bProp_Data"m_vecMaxs"vecm_b);  
    
GetEntPropVector(entity_bProp_Data"m_vecOrigin"vec_b);
    
GetEntPropVector(entity_bProp_Data"m_angRotation"ang_b);

    if( 
vectors_touching_code_here )
    { return 
true; }

    return 
false;

__________________
{__ PIRATES COVE __} ● HIGH-KILL Community | Stats ●
Half-Life 2: Deathmatch
66.151.244.149:27016 => CONNECT
scorpius2k1 is offline
Reply


Thread Tools
Display Modes

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 06:59.


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