Thread: Recast / Detour
View Single Post
Re: Recast / Detour
Old
  (#46)
The Storm
Council Member / E[POD]bot developer
 
The Storm's Avatar
 
Status: Offline
Posts: 1,618
Join Date: Jul 2004
Location: Bulgaria
Default Re: Recast / Detour - 04-09-2015

Well you derivate from HPB_bot which works well with ladders. It seems like while refactoring you forgot something?

I see this stuff in all HPB_bot derivates:
Code:
v_direction =
        pBot->dest_origin - (pEdict->v.origin +
                             (pEdict->v.velocity *
                              pBot->fTimeFrameInterval));
    Vector vecDirectionNormal = v_direction.Normalize();
    Vector vecDirection = vecDirectionNormal;
    vecDirectionNormal.z = 0.0;

    Vector vecMoveAngles = UTIL_VecToAngles(v_direction);
    vecMoveAngles.x = -vecMoveAngles.x;
    vecMoveAngles.z = 0;
    UTIL_ClampVector(&vecMoveAngles);
Where after additional check if the bot is going up or down a ladder the following code is executed
Code:
if(pBot->bOnLadder || pBot->bInWater)
		{
			Vector vecViewPos = pEdict->v.origin + pEdict->v.view_ofs;
			
			// Check if we need to go forward or back
			int iAngle = BotInFieldOfView( pBot, pBot->dest_origin - vecViewPos );
			// Press the correct buttons
			if(iAngle > 90)
				pEdict->v.button |= IN_BACK;
			else
				pEdict->v.button |= IN_FORWARD;
			if(pBot->bOnLadder)
			{
				// Ladders need view angles pointing up/down
				if(pBot->ladder_dir == LADDER_UP)
				{
					if(pEdict->v.button & IN_FORWARD)
						pEdict->v.v_angle.x = -60;
					else
						pEdict->v.v_angle.x = 60;
				}
				else
				{
					if(pEdict->v.button & IN_FORWARD)
						pEdict->v.v_angle.x = 60;
					else
						pEdict->v.v_angle.x = -60;
				}
				pEdict->v.angles.x = -pEdict->v.v_angle.x / 3;
				vecMoveAngles.x = pEdict->v.v_angle.x;
			}
			else
			{
				if(vecMoveAngles.x > 60.0)
					pEdict->v.button |= IN_DUCK;
				else if(vecMoveAngles.x < -60.0)
					pEdict->v.button |= IN_JUMP;
			}
		}
And then seems like the the vecAngles variable is only used
Code:
g_engfuncs.pfnRunPlayerMove( pEdict, vecMoveAngles, pBot->f_move_speed,
		pBot->f_sidemove_speed, 0, pEdict->v.button, 0, pBot->msecval);
I really didn't know what exactly is the problem with your code, I don't know the HL engine so well but I guess that it must be something very small that is missing. Keep on trying different variant and check the older code that you had based yours.
  
Reply With Quote