本文整理汇总了C++中FA2CSPose::IsValid方法的典型用法代码示例。如果您正苦于以下问题:C++ FA2CSPose::IsValid方法的具体用法?C++ FA2CSPose::IsValid怎么用?C++ FA2CSPose::IsValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FA2CSPose
的用法示例。
在下文中一共展示了FA2CSPose::IsValid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConvertCSRotationToBoneSpace
FQuat UAnimGraphNode_SkeletalControlBase::ConvertCSRotationToBoneSpace(const USkeletalMeshComponent* SkelComp, FRotator& InCSRotator, FA2CSPose& MeshBases, const FName& BoneName, const EBoneControlSpace Space)
{
FQuat OutQuat = FQuat::Identity;
if (MeshBases.IsValid())
{
int32 MeshBoneIndex = SkelComp->GetBoneIndex(BoneName);
FVector RotAxis;
float RotAngle;
InCSRotator.Quaternion().ToAxisAndAngle(RotAxis, RotAngle);
switch (Space)
{
// World Space, no change in preview window
case BCS_WorldSpace:
case BCS_ComponentSpace:
// Component Space, no change.
OutQuat = InCSRotator.Quaternion();
break;
case BCS_ParentBoneSpace:
{
const int32 ParentIndex = MeshBases.GetParentBoneIndex(MeshBoneIndex);
if (ParentIndex != INDEX_NONE)
{
FTransform ParentTM = MeshBases.GetComponentSpaceTransform(ParentIndex);
ParentTM = ParentTM.Inverse();
//Calculate the new delta rotation
FVector4 BoneSpaceAxis = ParentTM.TransformVector(RotAxis);
FQuat DeltaQuat(BoneSpaceAxis, RotAngle);
DeltaQuat.Normalize();
OutQuat = DeltaQuat;
}
}
break;
case BCS_BoneSpace:
{
FTransform BoneTM = MeshBases.GetComponentSpaceTransform(MeshBoneIndex);
BoneTM = BoneTM.Inverse();
FVector4 BoneSpaceAxis = BoneTM.TransformVector(RotAxis);
//Calculate the new delta rotation
FQuat DeltaQuat(BoneSpaceAxis, RotAngle);
DeltaQuat.Normalize();
OutQuat = DeltaQuat;
}
break;
}
}
return OutQuat;
}
示例2: ConvertWidgetLocation
FVector UAnimGraphNode_SkeletalControlBase::ConvertWidgetLocation(const USkeletalMeshComponent* SkelComp, FA2CSPose& MeshBases, const FName& BoneName, const FVector& Location, const EBoneControlSpace Space)
{
FVector WidgetLoc = FVector::ZeroVector;
if (MeshBases.IsValid())
{
USkeleton * Skeleton = SkelComp->SkeletalMesh->Skeleton;
int32 MeshBoneIndex = SkelComp->GetBoneIndex(BoneName);
switch (Space)
{
// ComponentToWorld must be Identity in preview window so same as ComponentSpace
case BCS_WorldSpace:
case BCS_ComponentSpace:
{
// Component Space, no change.
WidgetLoc = Location;
}
break;
case BCS_ParentBoneSpace:
if (MeshBoneIndex != INDEX_NONE)
{
const int32 MeshParentIndex = MeshBases.GetParentBoneIndex(MeshBoneIndex);
if (MeshParentIndex != INDEX_NONE)
{
const FTransform ParentTM = MeshBases.GetComponentSpaceTransform(MeshParentIndex);
WidgetLoc = ParentTM.TransformPosition(Location);
}
}
break;
case BCS_BoneSpace:
if (MeshBoneIndex != INDEX_NONE)
{
FTransform BoneTM = MeshBases.GetComponentSpaceTransform(MeshBoneIndex);
WidgetLoc = BoneTM.TransformPosition(Location);
}
}
}
return WidgetLoc;
}
示例3: ConvertCSVectorToBoneSpace
FVector UAnimGraphNode_SkeletalControlBase::ConvertCSVectorToBoneSpace(const USkeletalMeshComponent* SkelComp, FVector& InCSVector, FA2CSPose& MeshBases, const FName& BoneName, const EBoneControlSpace Space)
{
FVector OutVector = InCSVector;
if (MeshBases.IsValid())
{
int32 MeshBoneIndex = SkelComp->GetBoneIndex(BoneName);
switch (Space)
{
// World Space, no change in preview window
case BCS_WorldSpace:
case BCS_ComponentSpace:
// Component Space, no change.
break;
case BCS_ParentBoneSpace:
{
const int32 ParentIndex = MeshBases.GetParentBoneIndex(MeshBoneIndex);
if (ParentIndex != INDEX_NONE)
{
FTransform ParentTM = MeshBases.GetComponentSpaceTransform(ParentIndex);
OutVector = ParentTM.InverseTransformVector(InCSVector);
}
}
break;
case BCS_BoneSpace:
{
FTransform BoneTM = MeshBases.GetComponentSpaceTransform(MeshBoneIndex);
OutVector = BoneTM.InverseTransformVector(InCSVector);
}
break;
}
}
return OutVector;
}