UTIL SetModel: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
m (clean up, added orphan tag)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{wrongtitle|UTIL_SetModel}}
{{Orphan|date=January 2024}}
UTIL_SetModel is a UTIL function provided in the Source engine to set the model of an entity.
 
{{lang|UTIL SetModel|$title=UTIL_SetModel}}
'''UTIL_SetModel''' is a [[UTIL]] function provided in the [[Source]] engine to set the [[model]] of an [[entity]].


Appears to be largely obsolete and replaced by [[SetModel]], which sets the model for the entity it is called on, and not another entity.
Appears to be largely obsolete and replaced by [[SetModel]], which sets the model for the entity it is called on, and not another entity.
Line 14: Line 16:
void UTIL_SetModel( CBaseEntity *pEntity, const char *pModelName )
void UTIL_SetModel( CBaseEntity *pEntity, const char *pModelName )
</source>
</source>


== Examples ==
== Examples ==
Line 33: Line 34:
}
}
</source>
</source>
[[Category:Programming]]
[[Category:Programming]]
[[Category:UTIL]]
[[Category:UTIL]]

Latest revision as of 01:22, 6 January 2024

English (en)Translate (Translate)

UTIL_SetModel is a UTIL function provided in the Source engine to set the model of an entity.

Appears to be largely obsolete and replaced by SetModel, which sets the model for the entity it is called on, and not another entity.

Usage

//-----------------------------------------------------------------------------
// Purpose: Change another entity's model
// Input  : *pEntity - Entity to set the model on
// Input  : *pModelName - model name as string
// Output : 
//-----------------------------------------------------------------------------
void UTIL_SetModel( CBaseEntity *pEntity, const char *pModelName )

Examples

UTIL_SetModel( this, STRING( GetModelName() ) );
CEnvQuadraticBeam *CreateQuadraticBeam( const char *pSpriteName, const Vector &start, const Vector &control, const Vector &end, float width, CBaseEntity *pOwner )
{
	CEnvQuadraticBeam *pBeam = (CEnvQuadraticBeam *)CBaseEntity::Create( "env_quadraticbeam", start, vec3_angle, pOwner );
	UTIL_SetModel( pBeam, pSpriteName );
	pBeam->SetSpline( control, end );
	pBeam->SetScrollRate( 0.0 );
	pBeam->SetWidth(width);
	return pBeam;
}