Hey so I'm trying to parent an entity to the players back, but i can't get it to position correctly, it seems each time I run the function, the entity I am parenting ends up in a slightly different place, If anybody could provide any sort of help, I would very much appreciate it.
Here is the function I am using:
[code]
function meta:Parent_Ent( ent,attachment,vec,ang )
ent:SetCollisionGroup( COLLISION_GROUP_WORLD )
local aindex = self:LookupAttachment( attachment )
local atable = self:GetAttachment( aindex )
local f = self:GetAimVector():Angle()
f.p = 0
f.r = 0
ent:SetPos( atable.Pos + ( -f:Forward() * 10 ) )
ent:SetAngles( atable.Ang + ang )
ent:SetParent( self )
ent:Fire("setparentattachmentmaintainoffset",attachment, 0.01)
end
// Example of how I am using this function
ply:Parent_Ent( self,"chest",Vector( 0,0,0 ),Angle( 0,0,0 ) )
[/code]
[highlight](User was banned for this post ("wrong section" - postal))[/highlight]
You should snip this and post it in the right section before you get forum banned.
Sorry, you need to Log In to post a reply to this thread.