Entity SetAttachmentObject

From CryWiki

Jump to: navigation, search

entity:SetAttachmentObject(number, string, userdata, number, number)

Description

Sets an entity as an attachment.

Arguments

  1. Entity slot
  2. Attachment name
  3. Entity id
  4. ???
  5. 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, ...

Personal tools