.:: Bots United ::.

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

Pierre-Marie Baty 24-01-2005 14:36

entity origin?
 
Okay, I have an edict_t pointer.

edict_t *pEdict;

It can be anything, a player OR not. How can I determine the entity's origin ? I tried pEdict->GetCollideable()->GetCollisionOrigin() but that doesn't seem to be it. I know how to do it for players (although it seems to be the feet origin, watch the bbmin and bbmax), but does that mean that the new entities have no "origin" anymore ?

Accessorily, one second question: with this new engine, is the edict_t pointer still the best way to keep track of an entity ?

Cheeseh 24-01-2005 18:36

Re: entity origin?
 
I used this

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]);


assuming that you're in a network game (since it reads it's networkable object)

SteveC 24-01-2005 18:39

Re: entity origin?
 
I have found that not all entities work in the same way, much like you say the entity collision origin doesn't quite seem right all the time. But for 'box' like entities e.g. the bomb_zone entity, the line
Quote:

pEdict->GetCollideable()->WorldSpaceSurroundingBounds(&vMins, &vMaxs);
Works well.
If it returns vMins==vMaxs then the ->GetCollisionOrigin() is normally correct.

As to traking an entity, I don't know, especailly for 'created' entities. For map entities I just keep track of them in the list passed here, which seems to work so far;
Quote:

void CSCBotPlugin::ServerActivate( edict_t *pEdictList, int edictCount, int clientMax )

Pierre-Marie Baty 25-01-2005 00:33

Re: entity origin?
 
thanks a lot both of you, that seems to work indeed. I find it weird to need to navigate through completely different classes to get the info I want, especially Cheeseh's PVS kludge... wow. Scary. Now on for the cleanest way to draw beams...

Pierre-Marie Baty 25-01-2005 05:04

Re: entity origin?
 
ok, great.

Now does any of you know how to SET an entity's origin ? (teleporting a player). There's something related to props, but it looks scary and I don't want to include 50 header files again :(

Am I missing a simple way ?

sfx1999 25-01-2005 18:52

Re: entity origin?
 
Did you try looking at the teleporter code? trigger_teleport

Pierre-Marie Baty 25-01-2005 19:39

Re: entity origin?
 
They use SetAbsoluteOrigin on a CBaseEntity. The thing is, I don't WANT to access CBaseEntity, because it's mod specific.

SteveC 25-01-2005 21:08

Re: entity origin?
 
Keep looking, but don't rule out CBaseEntity. If a mod were to change this then a lot of other things would need to change. CBasePlayer on the other hand... well even I'm avoiding it at all costs. :D

Cheeseh 25-01-2005 21:10

Re: entity origin?
 
you might be able to do it through the new infoplayermanager interface (it has since been updated too along with the new bot stuff)
edit: -- ok no!

You can teleport a bot using it's "bot controller" object though

pinworm 11-07-2007 17:36

Re: entity origin?
 
has anyone found a solution to this problem, it doesnt seem like u can change players location thru a plugin?


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

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