Steam Users' Forums Walls & Collision Detection (How's it work? What's involved?)
 Register FAQ Search Today's Posts Mark Forums Read

 03-20-2012, 05:07 PM #1 serrath   Join Date: Feb 2012 Reputation: 0 Posts: 37 Walls & Collision Detection (How's it work? What's involved?) I want to grab some info about the player when he collides with a wall and some info about the wall (i.e. its facing, etc). I've been going through the wiki but I can't find what I'm after. Could someone link me to the relevant articles? Last edited by serrath: 03-20-2012 at 06:59 PM.
 03-20-2012, 10:11 PM #2 beonard6      Join Date: Aug 2010 Reputation: 7 Posts: 28 Touching walls is similatr to touching ground. Guess because both wall and ground have flag SOLID_BSP. Is you're asking about func_wall, well, source code is open for you.
 03-21-2012, 07:30 AM #3 serrath   Join Date: Feb 2012 Reputation: 0 Posts: 37 It says func_wall is outdated and I should be looking at func_brush instead? Specifically I want to determine the orientation of the plane of a surface the player bumps into. (It'd also be nice if I could tell when the player stops touching the surface.)
 03-21-2012, 07:47 AM #4 beonard6      Join Date: Aug 2010 Reputation: 7 Posts: 28 from gamemovement.cpp: Code: ```// Slide off of the impacting object // returns the blocked flags: // 0x01 == floor // 0x02 == step / wall int CGameMovement::ClipVelocity( Vector& in, Vector& normal, Vector& out, float overbounce ) { float backoff; float change; float angle; int i, blocked; angle = normal[ 2 ]; blocked = 0x00; // Assume unblocked. if (angle > 0) // If the plane that is blocking us has a positive z component, then assume it's a floor. blocked |= 0x01; // if (!angle) // If the plane has no Z, it is vertical (wall/step) blocked |= 0x02; // // Determine how far along plane to slide based on incoming direction. backoff = DotProduct (in, normal) * overbounce; for (i=0 ; i<3 ; i++) { change = normal[i]*backoff; out[i] = in[i] - change; } // iterate once to make sure we aren't still moving through the plane float adjust = DotProduct( out, normal ); if( adjust < 0.0f ) { out -= ( normal * adjust ); // Msg( "Adjustment = %lf\n", adjust ); } // Return blocking flags. return blocked; }``` PS: actually
 03-21-2012, 07:53 AM #5 serrath   Join Date: Feb 2012 Reputation: 0 Posts: 37 Ah, thank you! I'm trying to implement wall-running; I've got the vector math down, I just didn't know where to find this. Many thanks!

 Steam Users' Forums Walls & Collision Detection (How's it work? What's involved?)

 Thread Tools Display Modes Linear Mode

 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 Rules

All times are GMT -7. The time now is 03:29 PM.