how to change attached skin? [C#]

Hi all,
I will be glad to any help on my question. I need to change the skin of clothing from my character,
I'm trying to do it like this:

Code: Select all

CharacterAttachment chrHair = _character.GetAttachment("shois"); IAttachmentObject pSkinAttachment = new IAttachmentObject(); ISkin newSkin = Global.gEnv.pCharacterManager.LoadModelSKIN("Objects/Characters/MyChar/Famel/hair/", 0); chrHair.NativeHandle.AddBinding(pSkinAttachment, newSkin);
but I can not create an "IAttachmentObject":

Code: Select all

IAttachmentObject pSkinAttachment = new IAttachmentObject();

first I wanted to attach all the clothes to the character in the editor and unnecessary hide, but the character will have a lot of clothes and weapons, so this option is not suitable.

Re: how to change attached skin? [C#]

Creating a new IAttachmentObject is impossible, because it's just the interface in C++. Instead you would create an object that implements that interface, in your case the CSKINAttachment. However, the constructor for the CSKINAttachment is not available in C# at the moment (it's internal and requires an IntPtr to the unmanaged object) so in CRYENGINE 5.4 you can't create it with the new keyword. I'll see if I can add this to a future update of the engine, but it will not make it in for the 5.5 release since stabilisation for that release has already started.

What you could try is using GetIAttachmentObject on the IAttachment to get the already existing IAttachmentObject. The IAttachment is the NativeHandle of the CharacterAttachment in your example. Based on what you want to achieve this might be a solution for you.

Who is online

Users browsing this forum: No registered users and 0 guests