Download

Weapon crafting gameplay question

This is more of a search for advise post. In my project there will be weapon crafting and the ability to customize the look of various rifles and other guns. Is it ok to attach various components using sockets or will I run into performace problems?

It’s absolutely fine. In fact that’s the “correct” way to do it!

Best regards,
YoungWolf

Sweet man ill get to work on it this weekend

Something like this I am guessing.



	FAttachmentTransformRules* AttRules;
	const FName* sockName = Cast<FName>(WeapReceiver->GetSocketByName("socket"));
	ABarrel->AttachToComponent(WeapReceiver, AttRules->SnapToTargetNotIncludingScale, sockName);


And I know sockName will not work since its asking for a FName and not an *FName. Just wanted to know if I’m on the right path.

Yeah you are on the right path, but I wonder why are you using FName? If my memory doesn’t lie, AttachToComponent was requiring FString, not FName. I remember I used FStrings on 4.13.

Edit: In fact I used directly hardcoded TEXT(""). So maybe it converted it to an FName?

Just tried using FString it says no way to convert from Fstring to Fname

EDIT:
ABarrel->AttachToComponent(WeapReceiver, FAttachmentTransformRules::SnapToTargetNotIncludingScale, TEXT(“BarSock”));

Here we go the code compiles now to see if it actual works :P.

Duno how far you want to push it but just recently I run acrossthis paper on internet. You might find it useful.