Garry's Mod Wiki

Revision Difference

Entity:GetBodygroup#562776

<function name="GetBodygroup" parent="Entity" type="classfunc"> <description>Gets the exact value for specific bodygroup of given entity.⤶ <note>If called for Weapon (after Initialize hook) with different body groups on world model and view model will return value form view model.</note>⤶ </description> <description>⤶ Returns the <page text="Sub Model ID">Structures/BodyGroupData#submodels</page> for the currently active <page text="Sub Model">Entity:GetSubModels</page> of the Body Group corresponding to the given Body Group ID. </description> <realm>Shared</realm> <args> <arg name="id" type="number">The id of bodygroup to get value of. Starts from 0.</arg>⤶ <arg name="bodyGroupId" type="number">⤶ The Body Group ID to retrieve the active Sub Model ID for. ⤶ Body Group IDs start at `0`.⤶ </arg>⤶ </args> <rets> <ret name="" type="number">Current bodygroup. Starts from 0.</ret>⤶ <ret name="" type="number">⤶ The currently active Sub Model ID. ⤶ Sub Model IDs start at `0`.⤶ </ret>⤶ </rets> </function> <example> <description>Gets the value of bodygroup 2 of entity player 1 is aiming at.</description>⤶ <code>print( Entity(1):GetEyeTrace().Entity:GetBodygroup(2) )</code>⤶ <output>"1" in console, if player 1 is aiming at airboat.</output>⤶ ⤶ </example> <description>⤶ Gets the value of bodygroup 2 of entity player 1 is aiming at.⤶ </description>⤶ <code>⤶ print( Entity(1):GetEyeTrace().Entity:GetBodygroup(2) )⤶ </code>⤶ <output>⤶ "1" in console, if player 1 is aiming at airboat.⤶ </output>⤶ </example>