AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Detecting Midpoint (https://forums.alliedmods.net/showthread.php?t=88966)

BOYSplayCS 03-31-2009 07:10

Detecting Midpoint
 
Is it possible to detect the midpoint of an object/entity?

Like, find out how far in meters, it is from the outside to the middle?

SnoW 03-31-2009 09:39

Re: Detecting Midpoint
 
Usually entitys are created so the middle point is the origin, otherwise:
PHP Code:

Float:get_ent_mid_point(Float:sizes_a[3], Float:sizes_b[3])
{
    new 
float:mid_point[3];
    
mid_point[0] = (sizes_a[0] + -sizes_b[0]) : 2;
    
mid_point[1] = (sizes_a[1] + -sizes_b[1]) : 2;
    
mid_point[2] = (sizes_a[2] + -sizes_b[2]) : 2;
    return 
mid_point;



BOYSplayCS 03-31-2009 10:19

Re: Detecting Midpoint
 
Thanks SnoW :)


All times are GMT -4. The time now is 02:16.

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