Garry's Mod Wiki

Entity:SetMoveParent

  Entity:SetMoveParent( Entity Parent )

Description

Sets the Movement Parent of an entity to another entity.

Similar to Entity:SetParent, except the object's coordinates are not translated automatically before parenting.

Does nothing on client.

Arguments

1 Entity Parent
The entity to change this entity's Movement Parent to.

Example

Sets the Movement Entity of a new entity to Player 1.

local hat = ents.Create("prop_physics") //Position and angles are relative to our future parent. hat:SetPos(Vector(0,0,10)) hat:SetAngles(Angle(0,90,0)) hat:SetMoveParent(Entity(1)) hat:Spawn()