PDA

View Full Version : entity origin?


Pierre-Marie Baty
24-01-2005, 15:36
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, 19:36
I used this


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, 19:39
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

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;
void CSCBotPlugin::ServerActivate( edict_t *pEdictList, int edictCount, int clientMax )

Pierre-Marie Baty
25-01-2005, 01:33
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, 06:04
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, 19:52
Did you try looking at the teleporter code? trigger_teleport

Pierre-Marie Baty
25-01-2005, 20:39
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, 22:08
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, 22:10
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, 18:36
has anyone found a solution to this problem, it doesnt seem like u can change players location thru a plugin?

Whistler
13-07-2007, 18:16
has anyone found a solution to this problem, it doesnt seem like u can change players location thru a plugin?

You can do that. Try the waypoint teleporting function in POD-Bot. :)

pinworm
13-07-2007, 19:28
it looks like podbot is using metamod to enhance functionality. im looking into metamod now, i know very little about it. but with just using what valve sdk gives me with out too much excessive hacking, it doesnt look like there is a way to modify player variable just thru serverside plugin. am i wrong here?

ive found engine->setView(edict,edict) that will modify players viewpoint and position, but this seems like the only way to do it so far