.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   Half-Life 2 SDK (http://forums.bots-united.com/forumdisplay.php?f=62)
-   -   Yay - Bots move to given vector location... (http://forums.bots-united.com/showthread.php?t=3326)

stefanhendriks 06-01-2005 17:15

Re: Yay - Bots move to given vector location...
 
it would not suprise me if it did not work for bots... ;)

Cheeseh 06-01-2005 18:47

Re: Yay - Bots move to given vector location...
 
actually I just tried it with the bots, they got the origin ok, maybe you do need to "GetIServerEntity()" because i was still using that : *changes code on post*

botman 07-01-2005 02:26

Re: Yay - Bots move to given vector location...
 
I think when the bots spawn, they rotate to face the direction (YAW) of the spawnpoint, then they stay facing that way for the rest of the game.

Try creating your own little CS map with T and CT spawn points that face 0 and 180 degrees and I bet the bots that spawn there will be facing each other (or facing away from each other, whatever).

botman

stefanhendriks 07-01-2005 11:16

Re: Yay - Bots move to given vector location...
 
botman, that would not suprise me, as the spawn points always have had control about the view angles (in Hl1 aswell). Though this was not 'default' in HL1 with fake clients if i remember correctly :)

Gun-Nut 08-01-2005 01:09

Re: Yay - Bots move to given vector location...
 
got anymore good news?

botman 08-01-2005 02:33

Re: Yay - Bots move to given vector location...
 
I'm sure when something changes, someone will post news. No news means nothing has changed.

botman

stefanhendriks 09-01-2005 22:05

Re: Yay - Bots move to given vector location...
 
something changes
http://johannes.lampel.net/pics/shit/de_cbble0005.jpg

SteveC delivered some very helpfull stuff; though its not the neatest way to do it ;)

EDIT:
BUT there is no neater to way to do it as well!

Cheeseh 10-01-2005 21:30

Re: Yay - Bots move to given vector location...
 
** Total Edit ** :P

Alright, well I managed to get SteveC's CBaseEntity trick to work with my bots and got my bots to follow me whilst they look in the same direction (they don't look at me to follow me).

I have an example movie of a bot doing this here:

http://rcbot.bots-united.com/downloa...er/botmove.zip

The movement is actually the same as HL1 but the QAngles were between 0 and 360 instead of -180 and 180, which was confusing me.

PHP Code:

void CBot :: doMove ()
{
    
// Temporary measure to make bot follow me when i make listen serevr
    
setMoveTo(CBotGlobals::entityOrigin(INDEXENT(1)));

    if ( 
moveToIsValid () )
    {
        
float flMove 0.0;
        
float flSide 0.0;

        
m_fIdealMoveSpeed 320;

        
// fAngle is got from world realting to bots origin, not angles
        
float fAngle CBotGlobals::yawAngleFromEdict(m_pEdict,m_vMoveTo);
        
// fl Move is percentage (0 to 1) of forward speed,
        // flSide is percentage (0 to 1) of side speed.
        
        
float radians fAngle 3.141592f 180.0f// degrees to radians
        
flMove cos(radians);
        
flSide sin(radians);

        
m_fForwardSpeed m_fIdealMoveSpeed flMove;

        
// dont want this to override strafe speed if we're trying 
        // to strafe to avoid a wall for instance.
        
if ( m_fStrafeTime engine->Time() )
        {
            
// side speed 
            
m_fSideSpeed m_fIdealMoveSpeed flSide;
        }

        
// moving less than 1.0 units/sec? just stop to 
        // save bot jerking around..
        
if ( fabs(m_fForwardSpeed) < 1.0 )
            
m_fForwardSpeed 0.0;
        if ( 
fabs(m_fSideSpeed) < 1.0 )
            
m_fSideSpeed 0.0;
    }
    else
    {    
        
m_fForwardSpeed 0;
        
// bots side move speed
        
m_fSideSpeed 0;
        
// bots upward move speed (e.g in water)
        
m_fUpSpeed 0;
    }


To get the angle, here is the code i used:

PHP Code:

float CBotGlobals :: yawAngleFromEdict (edict_t *pEntity,Vector vOrigin)
{
    
float fAngle;
    
QAngle qBotAngles entityEyeAngles(pEntity);
    
QAngle qAngles;
    
Vector vAngles;

    
vAngles vOrigin entityOrigin(pEntity);

    
// Just get the angles from world
    
VectorAngles(vAngles,qAngles);
    
    
// NEED to put 0-360 angles from -180 to 180 to get negative and positive values
    
fixFloatAngle(&qBotAngles.y);
    
//fAngle = qAngles.y; // world angles
    
fAngle qBotAngles.qAngles.y;

    
fixFloatAngle(&fAngle);

    return 
fAngle;


you NEED CBaseEntity to get eye angles
PHP Code:

QAngle CBotGlobals :: entityEyeAngles edict_t *pEntity )
{
    
CBaseEntity *pBaseEntity CBaseEntity::Instance(pEntity);

    return 
pBaseEntity->EyeAngles();



stefanhendriks 11-01-2005 00:19

Re: Yay - Bots move to given vector location...
 
yes, i got this working too, you can see it in the ubframework alpha template.

currently my css bots walk around de_cbble using waypoints! yay.

Cheeseh 11-01-2005 00:24

Re: Yay - Bots move to given vector location...
 
crap well when I try it again while changing the viewangles they move all over the place, I think there might be something else to do with the getting the right angle from either world or player forward vector, I'm still a bit unsure


All times are GMT +2. The time now is 01:45.

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