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

Vertical Space Above Player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Luke Penny
Senior Member
Join Date: Jan 2010
Location: Canada
Old 09-22-2010 , 19:42   Vertical Space Above Player
Reply With Quote #1

I'm trying to check if a player is inside a building or not, so I want to check the vertical space above them for a roof or some sort of shelter above them. I'm not entirely sure how I would go about using TR_TraceHull (if that's what I should be using), if anyone has any examples that would be a great help, thanks!
__________________
Luke Penny is offline
Thrawn2
Veteran Member
Join Date: Apr 2009
Old 09-23-2010 , 01:39   Re: Vertical Space Above Player
Reply With Quote #2

http://forums.alliedmods.net/showpos...10&postcount=4
__________________
einmal mit profis arbeiten. einmal.
Thrawn2 is offline
Monkeys
Veteran Member
Join Date: Jan 2010
Old 09-23-2010 , 01:48   Re: Vertical Space Above Player
Reply With Quote #3

No need for the whole point_viewthingie shabang.
But here's the snippet out of all of that that would show you how to find if he has a ceiling
PHP Code:
stock Float:findCeiling(targetFloat:vecOrigin[3]) {
    
decl Float:vecPos[3];
    new 
Handle:trace TR_TraceRayFilterEx(vecOriging_vecDownCONTENTS_SOLID|CONTENTS_MOVEABLERayType_InfiniteTraceEntityFilterPlayertarget);

    if(
TR_DidHit(trace)) {
        
TR_GetEndPosition(vecPostrace);
        
//if(vecOrigin[2]-vecPos[2]>64) { // are they 60 units off the ground?
        //    PrintToChat(attacker, "\x04Airshot! \x01You hit \x04%N \x01in the air!", target);
        //    EmitSoundToClient(attacker, TF2DM_AIRSOUND, _, _, _, _, 1.0);
        //}
    
}

    
CloseHandle(trace);

    return 
vecPos[2];

This would find the position of the ceiling directly above him. Simply do a distance check and you'll know if he's close enough.
__________________
Get a lid on that zombie,
he's never gonna be alri-i-ight.
Oooh get a lid on that zombie,
or he's gonna feed all night.
Monkeys is offline
FaTony
Veteran Member
Join Date: Aug 2008
Old 09-24-2010 , 05:25   Re: Vertical Space Above Player
Reply With Quote #4

TraceHull can do too. And sometimes it's more preferred.
FaTony 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:38.


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