Thread: Recast / Detour
View Single Post
Re: Recast / Detour
Old
  (#35)
Neoptolemus
Member
 
Status: Offline
Posts: 93
Join Date: Apr 2012
Default Re: Recast / Detour - 28-08-2015

Thanks atomen!

I've started implementing ladders. My code now extracts the func_ladder brush and uses it to place waypoints at the top and bottom and hook it up to the navmesh.

In principle this works, the bot tries to climb the ladder, but despite looking upwards at the top and trying to move forwards, the bot just stays frozen at the foot of the ladder.

Am I missing something? I've confirmed that the bot is trying to move forwards, and they're looking upwards, but they just stay stuck on the ladder. My LookAt function looks like this:

Code:
void LookAt(bot_t* pBot, Vector target) {
	edict_t *pEdict = pBot->pEdict;

	Vector viewPos = pBot->pEdict->v.origin + pBot->pEdict->v.view_ofs;
	Vector dir = target - viewPos;
	Vector bot_angles = UTIL_VecToAngles(dir) - pEdict->v.punchangle;

	pEdict->v.idealpitch = bot_angles.x;
	pEdict->v.ideal_yaw = bot_angles.y;
	ClampAngle(pEdict->v.idealpitch);
	ClampAngle(pEdict->v.ideal_yaw);

	pEdict->v.v_angle.x = pEdict->v.idealpitch;
	pEdict->v.v_angle.y = pEdict->v.ideal_yaw;


	pEdict->v.angles.x = pEdict->v.v_angle.x * (1.f / 3.f);
	pEdict->v.angles.y = pEdict->v.v_angle.y;
	pEdict->v.angles.z = pEdict->v.v_angle.z = 0;
}
  
Reply With Quote