OpenMetaverse.ObjectManager.AttachObject C# (CSharp) Method

AttachObject() public method

Attach an object to this avatar
public AttachObject ( Simulator simulator, uint localID, AttachmentPoint attachPoint, Quaternion rotation ) : void
simulator Simulator A reference to the object where the object resides
localID uint The objects ID which is local to the simulator the object is in
attachPoint AttachmentPoint The point on the avatar the object will be attached
rotation Quaternion The rotation of the attached object
return void
        public void AttachObject(Simulator simulator, uint localID, AttachmentPoint attachPoint, Quaternion rotation)
        {
            ObjectAttachPacket attach = new ObjectAttachPacket();
            attach.AgentData.AgentID = Client.Self.AgentID;
            attach.AgentData.SessionID = Client.Self.SessionID;
            attach.AgentData.AttachmentPoint = (byte)attachPoint;

            attach.ObjectData = new ObjectAttachPacket.ObjectDataBlock[1];
            attach.ObjectData[0] = new ObjectAttachPacket.ObjectDataBlock();
            attach.ObjectData[0].ObjectLocalID = localID;
            attach.ObjectData[0].Rotation = rotation;

            Client.Network.SendPacket(attach, simulator);
        }