.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   Half-Life 1 SDK (http://forums.bots-united.com/forumdisplay.php?f=33)
-   -   Turning bot's head? (http://forums.bots-united.com/showthread.php?t=1114)

two_masks 17-03-2004 00:25

Turning bot's head?
 
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

Pierre-Marie Baty 17-03-2004 00:39

Re: Turning bot's head?
 
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 ?

two_masks 17-03-2004 02:08

Re: Turning bot's head?
 
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!

botman 17-03-2004 14:34

Re: Turning bot's head?
 
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

Pierre-Marie Baty 17-03-2004 15:28

Re: Turning bot's head?
 
@botman: that would be quite fun indeed :D

@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 :)

two_masks 17-03-2004 20:13

Re: Turning bot's head?
 
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?

Pierre-Marie Baty 17-03-2004 20:27

Re: Turning bot's head?
 
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).


All times are GMT +2. The time now is 15:14.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.