|
|
#1 |
![]() Join Date: Feb 2012
Reputation: 0
Posts: 36
|
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. |
|
|
|
|
|
#2 |
![]() 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. |
|
|
|
|
|
#3 |
![]() Join Date: Feb 2012
Reputation: 0
Posts: 36
|
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.)
|
|
|
|
|
|
#4 |
![]() 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;
}
|
|
|
|
|
|
#5 |
![]() Join Date: Feb 2012
Reputation: 0
Posts: 36
|
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!
|
|
|
|
![]() |
|
||||||
| Thread Tools | |
| Display Modes | |
|
|