Skip to content

Commit

Permalink
Merged : Reset bone location and rotation may cause trouble when swit…
Browse files Browse the repository at this point in the history
…ching between skeleton LODs #44
  • Loading branch information
pafuhana1213 committed Apr 11, 2022
1 parent 4659a10 commit 20c1ec0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void FAnimNode_KawaiiPhysics::EvaluateSkeletalControl_AnyThread(FComponentSpaceP
{
if (!Bone.bDummy)
{
Bone.UpdatePoseTranform(BoneContainer, Output.Pose);
Bone.UpdatePoseTranform(BoneContainer, Output.Pose, ResetBoneTransformWhenBoneNotFound);
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,18 @@ struct KAWAIIPHYSICS_API FKawaiiPhysicsModifyBone

public:

void UpdatePoseTranform(const FBoneContainer& BoneContainer, FCSPose<FCompactPose>& Pose)
void UpdatePoseTranform(const FBoneContainer& BoneContainer, FCSPose<FCompactPose>& Pose, bool ResetBoneTransformWhenBoneNotFound)
{
auto CompactPoseIndex = BoneRef.GetCompactPoseIndex(BoneContainer);
if (CompactPoseIndex < 0)
{
PoseLocation = FVector::ZeroVector;
PoseRotation = FQuat::Identity;
PoseScale = FVector::OneVector;
// Reset bone location and rotation may cause trouble when switching between skeleton LODs #44
if(ResetBoneTransformWhenBoneNotFound)
{
PoseLocation = FVector::ZeroVector;
PoseRotation = FQuat::Identity;
PoseScale = FVector::OneVector;
}
return;
}

Expand Down Expand Up @@ -300,6 +304,9 @@ struct KAWAIIPHYSICS_API FAnimNode_KawaiiPhysics : public FAnimNode_SkeletalCont
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Advanced Physics Settings", meta = (PinHiddenByDefault))
EPlanarConstraint PlanarConstraint = EPlanarConstraint::None;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Advanced Physics Settings", meta = (PinHiddenByDefault))
bool ResetBoneTransformWhenBoneNotFound = false;


UPROPERTY(EditAnywhere, Category = "Spherical Limits")
TArray< FSphericalLimit> SphericalLimits;
Expand Down Expand Up @@ -330,24 +337,24 @@ struct KAWAIIPHYSICS_API FAnimNode_KawaiiPhysics : public FAnimNode_SkeletalCont
FVector Gravity = FVector::ZeroVector;

/** Whether or not wind is enabled for the bodies in this simulation */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Wind, meta = (PinHiddenByDefault))
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Wind", meta = (PinHiddenByDefault))
bool bEnableWind = false;

/** Scale to apply to calculated wind velocities in the solver */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Wind, meta = (DisplayAfter = "bEnableWind"), meta = (PinHiddenByDefault))
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Wind", meta = (DisplayAfter = "bEnableWind"), meta = (PinHiddenByDefault))
float WindScale = 1.0f;

/**
* EXPERIMENTAL. Perform sweeps for each simulating bodies to avoid collisions with the world.
* This greatly increases the cost of the physics simulation.
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Collision, meta = (PinHiddenByDefault))
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Collision", meta = (PinHiddenByDefault))
bool bAllowWorldCollision = false;
//use component collision channel settings by default
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Collision, meta = (PinHiddenByDefault, EditCondition = "bAllowWorldCollision"))
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Collision", meta = (PinHiddenByDefault, EditCondition = "bAllowWorldCollision"))
bool bOverrideCollisionParams = false;
/** Types of objects that this physics objects will collide with. */
UPROPERTY(EditAnywhere, Category = Collision, meta = (FullyExpand = "true", EditCondition = "bAllowWorldCollision&&bOverrideCollisionParams"))
UPROPERTY(EditAnywhere, Category = "Collision", meta = (FullyExpand = "true", EditCondition = "bAllowWorldCollision&&bOverrideCollisionParams"))
FBodyInstance CollisionChannelSettings;


Expand Down

0 comments on commit 20c1ec0

Please sign in to comment.