.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > SDK Programming discussions > Half-Life 1 SDK
Half-Life 1 SDK For developments focused around Half-Life (and its mods) Half-Life

Reply
 
Thread Tools
Turning bot's head?
Old
  (#1)
two_masks
Guest
 
Status:
Posts: n/a
Default Turning bot's head? - 17-03-2004

Hi everyone,

A bit of a newbie question: I'm able to set my bot's body orientation and visual orientation, but when I change the direction it's "looking", the head doesn't turn with it! Do I have to manually do something to the head bone to do this? Any tips on turning bots' heads when they look around?

Thanks a lot!

-JB
  
Reply With Quote
Re: Turning bot's head?
Old
  (#2)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Turning bot's head? - 17-03-2004

Are you calling RunPlayerMove() each frame ? RunPlayerMove() is not only used to "move" the bot, it's in charge of ALL the model animations of a fakeclient (including turning head).

You must pass the view angle into this function, and the function will adapt itself the body angles given the horizontal and vertical velocities you give to your bot. It should not prevent you to fix the body angles yourself, though.


P.S. wow, you registered from berkeley.edu ? Is this an AI thesis project for school you are doing with this bot or something ?



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: Turning bot's head?
Old
  (#3)
two_masks
Guest
 
Status:
Posts: n/a
Default Re: Turning bot's head? - 17-03-2004

Thanks for the response Pierre-Marie,

Yes, I am calling RunPlayerMove, though I was trying to do my head turning on a stationary bot, i.e. my velocities were all zero. Giving the bot a forward velocity seems to correct the problem- the bot's torso will move now. This raises some additional questions for me, though. Primarily, how is a bot's motion related to the direction it's looking (v.v_angles) vs the direction it's facing (v.angles)? I was under the impression that I could have a bot walk straight ahead while turning it's torso to "look around"; it occured to me that this isn't how player controlled entities work, though- players move in the direction they're looking. So am I correct in concluding that "forward" motion is forward relative to the direction the bot is looking? Based on my observations this seems to be the case.

Secondly, is there a reason that my bot's torso won't turn when I don't have any forward or sideways velocity? It seems like it should be able to just stand and turn it's torso.

Btw, I'm working with the counterstrike mod, in case that changes things.

And no, this isn't a thesis project- I actually just graduated from Berkeley in December; this is for a project I'm doing at work. Lucky me huh?

Thanks for any help!
  
Reply With Quote
Re: Turning bot's head?
Old
  (#4)
botman
Super Moderator
 
Status: Offline
Posts: 280
Join Date: Jan 2004
Location: Plano, TX
Default Re: Turning bot's head? - 17-03-2004

v.angles is the angles of the bot's body. Adjusting the pitch of v.angles will cause the body to tilt forwards or backwards. Adjusting the yaw will cause the bot to spin in place to the left or to the right.

v.v_angles is the view angles of the bot (where it is looking/aiming). If you adjust the pitch of the view angle, the bot will look/aim up or down (but not tilt the body up or down). I don't think adjusting the yaw or the roll of the view angles does anything (since you can't tilt your head to the left or to the right and you can spin your head around a forward axis (i.e. spinning around a line draw straight out from your nose).

botman
  
Reply With Quote
Re: Turning bot's head?
Old
  (#5)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Turning bot's head? - 17-03-2004

@botman: that would be quite fun indeed

@two masks: In the latest versions of Half-Life (Steam versions), Valve changed the way the engine behaves with players and monsters. Now players can turn their torso while standing still, and their feet stay in the same position, unless the player takes a physically impossible position then the engine makes the player turn its feet as well. You can see this in Counter-Strike 1.6 for example. Before that, it was impossible for a player model to point a gun (and thus look) in another direction than the direction the player was moving forwards to, and it should NOT have been possible for bots as well (logically) but either there was an exception with bots or they left out a bug, but most of the bot makers used then to separate their bot's head angles and body angles. This had the advantage to make it easier for them to make their bots run in some direction while shooting at another. A normal player wouldn't have been able to do that, a normal player would have had to alternate his strafe left/right and forward/backwards keys while shooting if he wanted to shoot in some direction while running in another.

To separate your bot's body and head angles, either you are running the Steam HL engine or the old one.

- With the Steam engine:
1. If your player is standing still, you won't be able to change his body angles, only his view angles. It's the HL engine which will decide of the direction of your player's feet while standing still. You can still change your player's view angle by changing his v_angle, not omitting to pass the same value in RunPlayerMove. If you omit this, your player will not fire in the direction he's looking at, and there will then be 3 directions: FEET (body angles), GUN (v_angle) and HEAD (RunPlayerMove). Although the gun angle won't be differenciated from the head angles on the player model, it will just look as if the player was firing forwards and the bullets were going backwards or sideways.
2. If your player is running, his body angles will be determined by the forward, lateral and vertical speeds that you pass in RunPlayerMove. Again, it's the engine which will decide of the body angles according to the speeds passed. You are still in control of the head angles in the same way as above, though.

- With the old engine:
1. If your player is standing still, the engine will make his body angles identical to his view angles. If you change his view angles and reflect this change in RunPlayerMove, ALL the model's angles will rotate together. If you don't reflect your change in RunPlayerMove, all the model's angle will rotate but the player will be farting bullets by his ass hole.
2. If your player is moving, it's the exact same behaviour as with the new engine (see 2. above)

Being paid for doing a bot ? lucky man



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: Turning bot's head?
Old
  (#6)
two_masks
Guest
 
Status:
Posts: n/a
Default Re: Turning bot's head? - 17-03-2004

Thanks for the clarifications you two.

My big question now is how to get my bot to change aim angles smoothly. I know that I can set the ideal yaw and yaw speed to have HL interpolate the turn for me, but there doesn't seem to be an equivalent for view angle. Is there an easy, built-in way to get my bot to aim smoothly (instead of just jerking to the angle that I set it's FOV to) or do I have to interpolate manually?
  
Reply With Quote
Re: Turning bot's head?
Old
  (#7)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Turning bot's head? - 17-03-2004

You have to interpolate manually...

Look at this
http://racc.bots-united.com/releases/botaim_plugin.exe
for an example of how to achieve this (source code included as always).



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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 Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com