.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   Half-Life 2 SDK (http://forums.bots-united.com/forumdisplay.php?f=62)
-   -   draw beam (http://forums.bots-united.com/showthread.php?t=3315)

stefanhendriks 05-01-2005 17:31

Re: draw beam
 
you think? ;) i am writing the waypoint system from scratch, but i am talking about 20 wpts to be needed to be drawn. It somehow does not get drawn! here is my beam code:

Code:

void WaypointDraw(edict_t *pEdict)
{
        // When gWaypointSprite failed, try again here
        if (engine->IsModelPrecached(PHYSGUN_BEAM_SPRITE) || gWaypointSprite < 0)
        {
                // Precache sprite
                gWaypointSprite = engine->PrecacheModel(PHYSGUN_BEAM_SPRITE);
        }
        int iIndex=0;
        for (iIndex; iIndex < MAX_WAYPOINTS; iIndex++)
        {
                // every waypoint that has Vector != 0,0,0
                if (gWaypoints[iIndex].Origin != Vector(0,0,0))
                {
                        // Draw beam
                        //engine->
                        effects->Beam(gWaypoints[iIndex].Origin + Vector(0,0,-128),
                                                  gWaypoints[iIndex].Origin,
                                                  gWaypointSprite,
                                                  0,
                                                  0, 0, 10, 1, 1, 1, 0,
                                                  255,255,255,255,5);
/*
                                virtual void Beam( const Vector &Start, const Vector &End, int nModelIndex,
  int nHaloIndex, unsigned char frameStart, unsigned char frameRate,
  float flLife, unsigned char width, unsigned char endWidth, unsigned char fadeLength,
  unsigned char noise, unsigned char red, unsigned char green,
  unsigned char blue, unsigned char brightness, unsigned char speed) = 0;*/
                }
        }
}


Cheeseh 05-01-2005 21:01

Re: draw beam
 
could be the "fadeLength" parameter, try making it 255. Maybe make the width a bit more to see it easier too ;)

heres what i use for drawing a waypoint (try copying the values)
Code:

        g_pEffects->Beam( m_vOrigin - Vector(0,0,WAYPOINT_HEIGHT/2), m_vOrigin + Vector(0,0,WAYPOINT_HEIGHT/2), CWaypoints::waypointTexture(),
        0, 0, 1,
        1, WAYPOINT_WIDTH, WAYPOINT_WIDTH, 255,
        1, 0, 0, 255, 200, 10);

the waypoint origin is in the center so i draw from -36units to + 36units

stefanhendriks 06-01-2005 10:17

Re: draw beam
 
well, ok, the width is abit thin, but i like slim wpts ;) :D

i will try the fadelength.

Cheeseh 06-01-2005 18:49

Re: draw beam
 
okay looks as though I can't edit my old posts :'(

anyway.

this code works for bots and players and maybe even ohter entities which I havne't been able to test with yet (works with players and bots).

you may need GetIServerEntity

PHP Code:

Vector entityOrigin edict_t *pEntity )
{
    static 
float *fOrigin;
    
    
fOrigin pEntity->GetIServerEntity()->GetNetworkable()->GetPVSInfo()->m_vCenter;

    return 
Vector(fOrigin[0],fOrigin[1],fOrigin[2]);



stefanhendriks 06-01-2005 19:07

Re: draw beam
 
rofl, i somehow remember that you said that could be left out? ;) well i changed it into the above code and i will try it asap.

Cheeseh 06-01-2005 19:58

Re: draw beam
 
yeah I thought that because it would still compile and thought it would do basically the same thing but never actually tested it. Better look before i leap :P


All times are GMT +2. The time now is 17:49.

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