把Actor绑定到角色的插槽上

void AMonster::PostInitializeComponents()
{
Super::PostInitializeComponents();
// instantiate the melee weapon if a bp was selected
if( BPMeleeWeapon )
{
MeleeWeapon = GetWorld()->SpawnActor<AMeleeWeapon>(
BPMeleeWeapon, FVector(), FRotator() );
if( MeleeWeapon )
{
const USkeletalMeshSocket *socket = Mesh->GetSocketByName(
"RightHandSocket" ); // be sure to use correct
// socket name!
socket->AttachActor( MeleeWeapon, Mesh );
}
}
}
The monst

posted @ 2016-03-22 15:35  湛蓝玫瑰  阅读(395)  评论(0编辑  收藏  举报