# GetBoneIndex能否获取中文名骨骼序号

**URL:** <https://forums.unrealengine.com/t/getboneindex/2220865>\
**Category:** 简体中文 (Simplified Chinese)\
**Tags:** c-c, c-class-wizard, c-and-bluepri, c-custommeshcomponen, c-and-blueprint, c-error, c-class, c-custom-shape, c-programming, c-cone-shape, unreal-engine, CPP, question\
**Created:** [December 14, 2024, 8:26pm UTC](https://forums.unrealengine.com/t/getboneindex/2220865 "2024-12-14T20:26:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![YouYOUWo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@YouYOUWo](https://forums.unrealengine.com/u/YouYOUWo)\
**Post date:** [December 14, 2024, 8:26pm UTC](https://forums.unrealengine.com/t/getboneindex/2220865/1 "2024-12-14T20:26:35Z")

</div>

```auto
if(bWeaponEquipped && EquippedWeapon && EquippedWeapon->GetWeaponMesh() && PlayerCharacter->GetMesh())
	{
		LeftHandTransform = EquippedWeapon->GetWeaponMesh()
			->GetSocketTransform(FName("LeftHandSocket"), RTS_World);
		FVector OutPosition;
		FRotator OutRotation;
		PlayerCharacter->GetMesh()->TransformToBoneSpace(FName("右手首"), LeftHandTransform.GetLocation(), FRotator::ZeroRotator, OutPosition, OutRotation);

		UE_LOG(LogTemp, Log, TEXT("OutPosition: X = %f, Y = %f, Z = %f"), OutPosition.X, OutPosition.Y, OutPosition.Z);
		UE_LOG(LogTemp, Log, TEXT("OutRotation: Pitch = %f, Yaw = %f, Roll = %f"), OutRotation.Pitch, OutRotation.Yaw, OutRotation.Roll);
		LeftHandTransform.SetLocation(OutPosition);
		LeftHandTransform.SetRotation(FQuat(OutRotation));
	}

```

我是一个新手，在尝试使用FABRIK，将左手固定在枪械某部位。这里的`TransformToBoneSpace`接受一个Bone Name，我发现他调用了`GetBoneIndex`获取Index，填入我使用骨骼的BoneName，获取到了-1，即INDEX\_NONE，我该怎么处理，解决这个问题。
