Re: Recast / Detour
Quote:
Hi Immortal_BLG, thanks for jumping in. I believe I have met these requirements, however I'll detail the code I'm using to see if you can spot the mistake (don't worry, it's not much code). My BotThink function looks like this: Code:
void BotThink(bot_t *pBot) The UpdateView function does a bunch of stuff related to the bot's vision, and also makes the bot look its current waypoint: Code:
void UpdateView(bot_t* pBot) { and finally the LookAt code is listed here: Code:
void LookAt(bot_t* pBot, Vector target) { So every frame, the bot determines which direction it is heading in (i.e. whether it is moving forwards/backwards and strafing left/right) and updates the v_angle and angles to face its current waypoint. If I view the bot in first person mode as spectator, I can see its looking at the top of the ladder, and I have traces to confirm it is definitely MOVETYPE_FLY, and that it is currently trying to move forwards (the yellow line in the earlier screenshot indicates that y_movement_speed is maxspeed and x_movement_speed is 0 basically). Not sure what I'm missing here. |
Re: Recast / Detour
Did you tried my suggestion to set the *upmove* argument to max speed when the bot hits the ladder? :)
Also I as I see this is a custom map. Could you try to some of the default ones like cs_assault? |
Re: Recast / Detour
Quote:
I'll try a standard map when I get a chance :) |
Re: Recast / Detour
You need to invert the pitch of move angles
Code:
void LookAt(bot_t* pBot, Vector target) { |
Re: Recast / Detour
This is really weird.
To rule out the possibility that the bot is looking in the wrong direction, I have am now forcing the bot look directly upwards all the time (v.origin + Vector(0,0,100)) and the bot is still rooted to the floor when touching a ladder. I had assumed that pEdict->v.v_angles were the view angles, and pEdict->v.angles were the movement angles. However, when I implement your fix for the code, Immortal, the bot looks the wrong way (i.e. he looks at his feet, not upwards). This is both in first and third person. To me this suggests his movement and view angles are both being modified even though the code doesn't do this. I have tried every possible combination of inputs into pfnRunPlayerMove, including both v.angles and v.v_angle in the second parameter, using the inversion in LookAt and not using it, and setting the upmove parameter to maxspeed. I really don't get this at all :-( EDIT: This also happens on official maps, and even if the bot accidentally touches a ladder while moving elsewhere. In other words, they're trying to move AWAY from the ladder, but by accidentally touching the ladder they become completely frozen and unable to move until they die or I restart the round. Seriously, what the hell? |
Re: Recast / Detour
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 = Code:
if(pBot->bOnLadder || pBot->bInWater) Code:
g_engfuncs.pfnRunPlayerMove( pEdict, vecMoveAngles, pBot->f_move_speed, |
Re: Recast / Detour
hi,
1. I think forwardmove,.., upmove are not in map coordinates but rather in "local" coordinates, with forward= dir. of wished move, ie dir. of look; climbing a ladder requires a positive value for forward speed and upmove=0. 2. bot will not climb if IN_FORWARD button is not set ( a speed!=0 is not enough) hope this helps. |
Re: Recast / Detour
Yes I forgot to write, you should combine fixed LookAt() function with giving fixed v.angles to RunPlayerMove.
If you already try it, so I don't know what can I advise to check next... But if you say, that bot tries to move in opposite direction (away from ladder), then something wrong with bot move direction pitch... |
Re: Recast / Detour
Quote:
The view angles are still messed up though, even though the bot is looking upwards, they climb very slowly as though they're looking dead ahead. If I manually set the bot's angles myself they climb just like a human, so my lookat function is dodgy. As you guys have suggested, I'll go back through the original HPB bot code to figure it out. Progress! |
Re: Recast / Detour
A screenshot in action, showing the bot getting onto the roof of the warehouse in cs_assault.
https://dl.dropboxusercontent.com/u/...t_Climbing.png I basically just copied the bot's looking code from the original HPB Bot (the code used to shoot at tripmines). It seems like all is now well, except that the ladder climbing is still not perfect. The bot usually pauses for a second or two at the foot of the ladder before beginning ascent, and still climbs significantly slower than a human, but at least they're doing it reliably now. |
All times are GMT +2. The time now is 09:49. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.