FollowEntity(): Difference between revisions
Jump to navigation
Jump to search
No edit summary |
Ninjaofsauce (talk | contribs) (Added category, added attachment and bone section) |
||
| (6 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
C++ function used to control the [[Entity Hierarchy (parenting)|parent]] of the current entity. | |||
== | ==Syntax== | ||
FollowEntity( [[CBaseEntity]] *pBaseEntity, [[bool]] bBoneMerge = true ) | |||
== Values == | |||
The | |||
[[Category:Functions]] | ;<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, but it will not reset the entity's <code>[[MoveType]]</code>. | |||
;<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. | |||
==Bones and Attachments== | |||
To find attachment points and bone names, there are several methods: Check ''modelname.qc''(SourceSDK has examples), use [[hlmv]] or other model software, use [[ent_attachments]] console command, or LookupAttachment() if programming. | |||
{{TODO|Code calls/console commands related to bones?}} | |||
== Related functions == | |||
*'''<code>GetFollowedEntity()</code>''' returns the parent entity as <code>C_BaseEntity</code>. | |||
*'''<code>IsFollowingEntity()</code>''' returns <code>true</code> if the entity has a parent. | |||
[[Category:Functions]][[Category:Programming]] | |||
Latest revision as of 16:56, 22 October 2025
C++ function used to control the parent of the current entity.
Syntax
FollowEntity( CBaseEntity *pBaseEntity, bool bBoneMerge = true )
Values
pBaseEntity- Defines a parent. In doing so:
- Zeroes origin and angles
- Sets
MOVETYPE_NONE - Adds
FSOLID_NOT_SOLID
pBaseEntity = NULL- The entity leaves its parent and moves on its own.
StopFollowingEntity()may also be used, but it will not reset the entity'sMoveType. bBoneMerge = false- Prevent the current entity from moving with
pBaseEntity's animations. It will move relative topBaseEntity's origin only.
Bones and Attachments
To find attachment points and bone names, there are several methods: Check modelname.qc(SourceSDK has examples), use hlmv or other model software, use ent_attachments console command, or LookupAttachment() if programming.
Todo: Code calls/console commands related to bones?
Related functions
GetFollowedEntity()returns the parent entity asC_BaseEntity.IsFollowingEntity()returnstrueif the entity has a parent.