Create(): Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (redir)
 
(un-redirected: not specific to TEs!)
Line 1: Line 1:
#redirect [[Temporary Entity]]
'''<code>CBaseEntity::Create()</code>''' creates and [[Spawn()|spawns]] a new [[entity]]. It can be called directly as well as from an existing object. {{todo|Is there any difference between those two approaches?}}
 
There is also <code>[[CBaseTempEntity]]::Create()</code>, which has a similar purpose but behaves quite differently.
 
== Arguments ==
 
; <code>const [[char]]* szName</code>
: The [[classname]] of the entity that should be created. Must be a pointer to constant memory; an ordinary string literal like <code>"npc_class"</code> will do.
; <code>const [[Vector]]& vecOrigin</code>
: The initial [[origin]] of the entity.
; <code>const [[QAngle]]& vecAngles</code>
: The initial orientation of the entity.
; <code>[[CBaseEntity]]* pOwner</code>
: The [[owner]] of the new entity. Pass <code>NULL</code> if there shouldn't be one.
 
[[Category:Functions]]

Revision as of 09:29, 16 September 2009

CBaseEntity::Create() creates and spawns a new entity. It can be called directly as well as from an existing object.

Todo: Is there any difference between those two approaches?

There is also CBaseTempEntity::Create(), which has a similar purpose but behaves quite differently.

Arguments

const char* szName
The classname of the entity that should be created. Must be a pointer to constant memory; an ordinary string literal like "npc_class" will do.
const Vector& vecOrigin
The initial origin of the entity.
const QAngle& vecAngles
The initial orientation of the entity.
CBaseEntity* pOwner
The owner of the new entity. Pass NULL if there shouldn't be one.