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_a, int 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_a, Prop_Data, "m_vecMaxs", vecm_a);
GetEntPropVector(entity_a, Prop_Data, "m_vecOrigin", vec_a);
GetEntPropVector(entity_a, Prop_Data, "m_angRotation", ang_a);
GetEntPropVector(entity_b, Prop_Data, "m_vecMaxs", vecm_b);
GetEntPropVector(entity_b, Prop_Data, "m_vecOrigin", vec_b);
GetEntPropVector(entity_b, Prop_Data, "m_angRotation", ang_b);
if( vectors_touching_code_here )
{ return true; }
return false;
}
__________________