Snoothy
(Snoothy)
June 13, 2015, 1:00am
1
I have an actor containing a skeletal mesh, this skeletal mesh has a scene component socketed to the bone “hand_r”. How can the scene component get the name “hand_r” in this scenario?
“Get Attach Parent”, I believe, gives me the skeletal mesh but I need a reference to the bone or just the name of it.
Zaucy
(Zaucy)
June 13, 2015, 2:09am
2
I believe you are looking for AttachSocketName in USceneComponent (third variable.) This is the way you access it through C++.
Unfortunately this variable is not exposed through blueprint. You’ll have to implement some way to retrieve it yourself.
Example Solution
Header
#pragma once
#include "Kismet/BlueprintFunctionLibrary.h"
#include "Components/SceneComponent.h"
#include "MyBlueprintFunctionLibrary.generated.h"
UCLASS()
class MY_GAME_API UMyBlueprintFunctionLibrary
: public UBlueprintFunctionLibrary {
GENERATED_BODY()
public:
UFUNCTION(Category="MyCategory", BlueprintCallable)
static FName GetSceneComponentAttachSocketName(USceneComponent* SceneComponent);
};
Source
FName UBasics::GetSceneComponentAttachSocketName(USceneComponent* SceneComponent) {
return SceneComponent->AttachSocketName;
}
Blueprint Usage
After compiling it should look something similar to this. Good luck!