Raised This Month: $ Target: $400
 0% 

Detecting Midpoint


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 03-31-2009 , 07:10   Detecting Midpoint
Reply With Quote #1

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?
BOYSplayCS is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 03-31-2009 , 09:39   Re: Detecting Midpoint
Reply With Quote #2

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;


Last edited by SnoW; 03-31-2009 at 09:56.
SnoW is offline
Send a message via MSN to SnoW
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 03-31-2009 , 10:19   Re: Detecting Midpoint
Reply With Quote #3

Thanks SnoW
BOYSplayCS 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 02:16.


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