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

Position, vmax, vmin calculation


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Razmo51
Senior Member
Join Date: Aug 2011
Location: Event "player_death
Old 12-13-2014 , 13:25   Position, vmax, vmin calculation
Reply With Quote #1

Hello,

How can I calculate center position and vmax and vmin from 2 pos ?

I can't get it well done with this:


Code:
    new Float:vMax[3], Float:vMin[3], Float:pos[3];
    
    AddVectors(pos1, pos2, pos);
    pos[0] /= 2;
    pos[1] /= 2;
    pos[2] /= 2;
    
    vMin[0] = pos[0]-pos1[0];
    vMin[1] = pos[1]-pos1[1];
    vMin[2] = pos[2]-pos1[2];
    
    for(new  i = 0; i <= 2; i++)
    {
        if(vMin[i] > 0)
            vMin[i] *= -1;
    }
    
    vMax[0] = vMin[0]*-1;
    vMax[1] = vMin[1]*-1;
    vMax[2] = vMin[2]*-1;
Already tried with some AddVectors or SubstractVector, but none work ....

help please
__________________
Sorry for my bad English, I'm Belgian

Last edited by Razmo51; 12-13-2014 at 13:25.
Razmo51 is offline
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 12-13-2014 , 13:41   Re: Position, vmax, vmin calculation
Reply With Quote #2

PHP Code:
stock GetBrushEntityAbsOrigin(iEntFloat:vOrigin[3])

    
decl Float:vMins[3], Float:vMaxs[3

    
GetEntPropVector(iEntProp_Send"m_vecOrigin"vOrigin);
    
GetEntPropVector(iEntProp_Send"m_vecMins"vMins);
    
GetEntPropVector(iEntProp_Send"m_vecMaxs"vMaxs);

    
vOrigin[X] += (vMins[X] + vMaxs[X]) * 0.5;
    
vOrigin[Y] += (vMins[Y] + vMaxs[Y]) * 0.5;
    
vOrigin[Z] += (vMins[Z] + vMaxs[Z]) * 0.5;

__________________
Chdata is offline
Razmo51
Senior Member
Join Date: Aug 2011
Location: Event "player_death
Old 12-13-2014 , 14:11   Re: Position, vmax, vmin calculation
Reply With Quote #3

I don't have any entity to hook, just positions

I need this to create an entity
__________________
Sorry for my bad English, I'm Belgian

Last edited by Razmo51; 12-13-2014 at 16:10.
Razmo51 is offline
Reply



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 13:58.


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