Raised This Month: $ Target: $400
 0% 

Get distance from ground


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-08-2013 , 19:51   Re: Get distance from ground
Reply With Quote #1

I know that engine doesn't use same hull as dll for crouch players. But i've seen that dll has a way to tell the engine which hulls it is using.
So, finally, don't know if with TraceHull engine uses correct hull when player is crouched.
So, do as if player was not crouched, can be a problem if player is right under a ceil.

PHP Code:
Float:distance_to_groundid )
{
    new 
Float:start[3], Float:end[3], bool:bDucking;
    
entity_get_vector(idEV_VEC_originstart);
    
bDucking = !!(entity_get_int(idEV_INT_flags) & FL_DUCKING);
    if( 
bDucking )
    {
        
start[2] += 18.0;
    }

    
end[0] = start[0];
    
end[1] = start[1];
    
end[2] = start[2] - 9999.0;

    new 
ptr create_tr2();
    
engfunc(EngFunc_TraceHullstartdestIGNORE_MONSTERSHULL_HUMANidptr);
    new 
Float:distance;
    
get_tr2(ptrTR_flFractiondistance);
    
free_tr2(ptr);

    if( 
distance 1.0 )
    {
        
distance *= 9999.0;
        if( 
bDucking )
        {
            
distance -= 18.0;
            return 
distance;
        }
    }
    return -
1.0

__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 10:55.


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