> I see two potential problems with the way you're spawning the entity.  First,
> you're using GetClassPtr() to create an instance of the CBreakable class.  Most
> other places in the SDK where an entity is created use the
> CREATE_NAMED_ENTITY() macro to instantiate the class.

This is wrong, there are 8 calls to CREATE_NAMED_ENTITY and 81 calls to
GetClassPtr, in my mod anyways :}

>  Second, you should call
> DispatchSpawn() instead of calling the CBreakable's spawn function yourself.
> Take a look at CBaseEntity::Create() or CMonsterMaker::MakeMonster() for other
> examples of how entities can be created by other entities in the SDK.

Calling the spawn function is fine, it is done for grenades, spraycans, rpg
rockets and many other things.

Fundamentally I don't think there is much difference in either of these methods.
However as nothing else has worked I tried the following code, with exactly the
same results, i.e it spawn and is displayed but does not collide.

 Vector origint = VecBModelOrigin(pev); // Get origin of model

 edict_t *pent;
 CBaseEntity *pEntity;

 pent = CREATE_NAMED_ENTITY(MAKE_STRING("func_breakable"));
 if ( !(FNullEnt( pent ) ))
 {
     pEntity = Instance( pent );
     pEntity->pev->origin = origint;
     pEntity->pev->model  = MAKE_STRING(CSDE_MODEL);
     DispatchSpawn(pent);
}

Jeff.



_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to