So, I’m trying to access a bone (or socket) by name.
I can get it’s position by calling GetSocketLocation(), but when I try to get a USkeletalMeshSocket via GetSocketByName(), I always get a nullptr for the bone with the same name.
// This works fine, and returns a correct location
SkeletalMesh->GetSocketLocation("MyBoneName");
// However this always returns nullptr
SkeletalMesh->GetSocketByName("MyBoneName");
Is it a bug or I’m doing something wrong here?
Thanks!
Hi, I find it a bit weird that I have to create a “socket” on top of an existing bone. I actually assumed that socket = bone (since naming in UE4 in general is pretty weird). But, anyway, you’re absolutely correct, adding the socket manually fixes the problem! Thanks, cheers!
You have to create them manually because socket can have an additional offset on top of the bone.
I think having automatic socket for every bone would make the skeleton tree kinda unreadable and would be an unnecessary overhead. But i agree about naming, sometime it could be better ^^
What I don’t get is that when you call GetMesh()->DoesSocketExist(FName(“BoneName”)) with the BoneName it returns true but trying toget the socket returns Nulllptr. This is very confusing and non-intuitive.