FollowEntity(): Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
==void C_BaseEntity::'''FollowEntity'''( CBaseEntity *pBaseEntity, bool bBoneMerge = true )==
Used to control the [[Entity Hierarchy (parenting)|parent]] of the current entity.
This function is used to control the parent of {{this}} entity.
 
===FollowEntity( NULL )===
==Syntax==
This call makes {{this}} entity stop following its parent.
 
===FollowEntity( pBaseEntity )===
FollowEntity( [[CBaseEntity]] *pBaseEntity, [[bool]] bBoneMerge = true )
This call sets {{this}} entity's parent to <code>pBaseEntity</code>; it also zeroes {{this}} entity's origin and angles, sets its move type to <code>MOVETYPE_NONE</code> and adds the solid flag <code>FSOLID_NOT_SOLID</code>.
 
===FollowEntity( pBaseEntity, false )===
== Values ==
The only difference between the settings of <code>bBoneMerge</code> is having it set to false makes {{this}} entity not follow <code>pBaseEntity</code>'s animations. This is the call to use if the entity should be in a static position relative to <code>pBaseEntity</code>.
 
;<code>pBaseEntity</code>
:Defines a parent. In doing so:
:*Zeroes [[origin]] and [[angles]]
:*Sets <code>[[MOVETYPE_NONE]]</code>
:*Adds <code>[[FSOLID_NOT_SOLID]]</code>
;<code>pBaseEntity = NULL</code>
:The entity leaves its parent and moves on its own. <code>StopFollowingEntity()</code> may also be used.
;<code>bBoneMerge = false</code>
:Prevent the current entity from moving with <code>pBaseEntity</code>'s animations. It will move relative to <code>pBaseEntity</code>'s origin only.
 
{{TODO|How to choose an attachment point?}}
 
[[Category:Functions]]
[[Category:Functions]]

Revision as of 01:36, 5 April 2008

Used to control the parent of the current entity.

Syntax

FollowEntity( CBaseEntity *pBaseEntity, bool bBoneMerge = true )

Values

pBaseEntity
Defines a parent. In doing so:
pBaseEntity = NULL
The entity leaves its parent and moves on its own. StopFollowingEntity() may also be used.
bBoneMerge = false
Prevent the current entity from moving with pBaseEntity's animations. It will move relative to pBaseEntity's origin only.
Todo: How to choose an attachment point?