Entity.SetParent
From GMod Wiki
Function | |
Syntax | Entity:SetParent( Entity Parent ) |
Description: | |
Sets (or clears) the entity's parent. | |
Returns: | nil |
In Object: | Entity |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Entity.SetParent]Entity.SetParent [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Additional Notes
- Parent is optional. If parent isn't given, or nil is given in it's place, the entity's parent will be cleared.
- Child entities will move with the parent entity.
- Currently, entities with a parent can not be safely interacted with. Bounding boxes are invisible and are not aligned properly.
- Currently, through my testings, entities that are parented and that are moved with the phys gun, create a clone of it's physics model somewhere else on the map. This physics model can collide with players and entities.
- Currently, you can parent 2 entities and weld them to restore the physics on the child and still have some qualities of parenting.
- You can also use Entity:SetSolid() instead of welding to restore the physics.