apply the transform to the output pose
This commit is contained in:
@@ -152,11 +152,17 @@ void FSGVirtualHandAnimInstanceProxy::PreEvaluateAnimation(UAnimInstance* InAnim
|
||||
}
|
||||
|
||||
FRotator JointRotation{FingerJointRotations[JointIndex]};
|
||||
/*const FRotator JointRotation{FingerJointRotations[JointIndex]};
|
||||
const FQuat JointQuat{JointRotation.Quaternion()};
|
||||
const FRotator ReferenceRotation{Hand->GetActorRotation()};
|
||||
const FQuat ReferenceQuat{ReferenceRotation.Quaternion()};
|
||||
FRotator BoneRotation{ReferenceQuat * JointQuat};*/
|
||||
|
||||
FName BoneName(Hand->IsRight()
|
||||
? GetRightHandBoneName(FingerIndex, JointIndex)
|
||||
: GetLeftHandBoneName(FingerIndex, JointIndex));
|
||||
|
||||
//BoneMap.Emplace(MoveTemp(BoneName), MoveTemp(BoneRotation));
|
||||
BoneMap.Emplace(MoveTemp(BoneName), MoveTemp(JointRotation));
|
||||
}
|
||||
}
|
||||
@@ -207,6 +213,7 @@ bool FSGVirtualHandAnimInstanceProxy::Evaluate(FPoseContext& Output)
|
||||
FAnimNode_ModifyBone BoneController;
|
||||
BoneController.BoneToModify = MoveTemp(BoneReference);
|
||||
BoneController.RotationMode = EBoneModificationMode::BMM_Replace;
|
||||
//BoneController.RotationSpace = EBoneControlSpace::BCS_WorldSpace;
|
||||
BoneController.RotationSpace = EBoneControlSpace::BCS_ComponentSpace;
|
||||
BoneController.Rotation = MoveTemp(BoneRotation);
|
||||
|
||||
@@ -218,9 +225,12 @@ bool FSGVirtualHandAnimInstanceProxy::Evaluate(FPoseContext& Output)
|
||||
const TArray<FBoneTransform>::SizeType BoneTransformsNum = BoneTransforms.Num();
|
||||
if (BoneTransformsNum > 0)
|
||||
{
|
||||
const FCompactPoseBoneIndex PoseBoneIndex{static_cast<FCompactPoseBoneIndex>(BoneIndex)};
|
||||
const FCompactPoseBoneIndex PoseBoneIndex{
|
||||
BoneController.BoneToModify.GetCompactPoseIndex(
|
||||
PoseContext.Pose.GetPose().GetBoneContainer())
|
||||
};
|
||||
const FTransform BoneTransformBefore{PoseContext.Pose.GetComponentSpaceTransform(PoseBoneIndex)};
|
||||
PoseContext.Pose.SetComponentSpaceTransform(PoseBoneIndex, BoneTransforms[0].Transform);
|
||||
PoseContext.Pose.LocalBlendCSBoneTransforms(BoneTransforms, 1.0f);
|
||||
const FTransform BoneTransformAfter{PoseContext.Pose.GetComponentSpaceTransform(PoseBoneIndex)};
|
||||
|
||||
SGLOG("BoneController.Rotation", BoneController.Rotation);
|
||||
@@ -228,6 +238,10 @@ bool FSGVirtualHandAnimInstanceProxy::Evaluate(FPoseContext& Output)
|
||||
SGLOG("BoneTransformBefore.Rotation", BoneTransformBefore.Rotator());
|
||||
SGLOG("BoneTransformAfter.Rotation", BoneTransformAfter.Rotator());
|
||||
|
||||
// Output.Pose[PoseBoneIndex].SetRotation(
|
||||
// PoseContext.Pose.GetComponentSpaceTransform(PoseBoneIndex).GetRotation());
|
||||
PoseContext.Pose.ConvertComponentPosesToLocalPoses(PoseContext.Pose, Output.Pose);
|
||||
|
||||
HandMeshComponent->MarkRenderStateDirty();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user