From CryWiki
entity:SetAttachmentObject(number, string, userdata, number, number)
Description
Sets an entity as an attachment.
Arguments
- Entity slot
- Attachment name
- Entity id
- ???
- flags
Example
|
Lua (example)
|
-- Make an entity, which will be attached to the local actor
local ent = System.SpawnEntity({class="TACGun"});
-- Make an attachment on the right hip of the localactor, called MyAttachment
g_localActor:CreateBoneAttachment(0, "weaponPos_grenade_R_hip", "MyAttachment");
-- Sets the spawned entity as attachment
g_localActor:SetAttachmentObject(0,"MyAttachment",ent.id, -1, 0);
-- Remember to go third person to see the effect
|
|
Notes
To set the angles/position/direction/... of the attachment, check out the SetAttachmentXXX functions, like SetAttachmentAngles, SetAttachmentPos, SetAttachmentDir, ...