Pointcontents should return CONTENTS_SOLID if you're in the void.
Part of the map compilation process is to 'fill the outside' with
contents_solid.

So a simple 
If ( UTIL_PointContents( position ) & CONTENTS_SOLID ) )
{
 In a solid, or the void
}

Should work.

Noclip around and test it with this command:
CON_COMMAND_F( dbg_contents, "dbg contents", FCVAR_CHEAT )
{
        CBasePlayer *pPlayer = UTIL_GetCommandClient();
        if ( !pPlayer )
                return;

        int contents = UTIL_PointContents( pPlayer->GetAbsOrigin() );
        if ( contents & CONTENTS_SOLID )
                DevMsg("in solid\n");

        DevMsg(" Contents: %i\n", contents );

}


-Tony
 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Andrew
Watkins
Sent: September-18-08 3:20 AM
To: [email protected]
Subject: [hlcoders] Detecting point is outside world

Hey all, very simple question that I can't seem to find the answer to -
how 
to tell if a point is outside the game world or not?

I've added an ability allowing players to teleport a short distance, 
including through walls, to our HL2MP OB mod. This is great, and the
code 
successfully avoids getting the player stuck inside world brushes or 
anything else when teleporting. It is unfortunately possible for them to

teleport to completely outside the world geometry, and I can't work out
how 
to stop this. I've tried my hull traces using various likely-looking
masks & 
collision groups, and have looked at all the UTIL_PointContents flags,
but I 
can't see how to determine if a point is outside the world or not.

I've also looked through gamemovement.cpp, as players don't fall when
they 
teleport outside the world, so something must be stopping them, as they 
aren't "in a solid" - but nothing jumps out at me. So, does anyone know
how 
to determine if a point / trace / entity is completely outside the world

geometry?

The best "hacky" method I can come up with is testing if a 
several-thousand-unit-long trace can be done in any direction 
(up/down/n/s/e/w), and if any can, assume its outside. I'm sure there's
a 
point contents method, but I can't work it out. Help would be
appreciated.

Thanks 


_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders


_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to