diff --git a/Content/KawaiiPhysicsSample/GrayChan/ABP_GC_ExternalForce.uasset b/Content/KawaiiPhysicsSample/GrayChan/ABP_GC_ExternalForce.uasset index ea0cf5f..28dd566 100644 Binary files a/Content/KawaiiPhysicsSample/GrayChan/ABP_GC_ExternalForce.uasset and b/Content/KawaiiPhysicsSample/GrayChan/ABP_GC_ExternalForce.uasset differ diff --git a/Content/KawaiiPhysicsSample/KawaiiPhysicsSample.umap b/Content/KawaiiPhysicsSample/KawaiiPhysicsSample.umap index 36ea34b..3ae5be3 100644 Binary files a/Content/KawaiiPhysicsSample/KawaiiPhysicsSample.umap and b/Content/KawaiiPhysicsSample/KawaiiPhysicsSample.umap differ diff --git a/Content/KawaiiPhysicsSample/Skirt/ABP_Skirt_ExternalForce.uasset b/Content/KawaiiPhysicsSample/Skirt/ABP_Skirt_ExternalForce.uasset index 121778e..f168bda 100644 Binary files a/Content/KawaiiPhysicsSample/Skirt/ABP_Skirt_ExternalForce.uasset and b/Content/KawaiiPhysicsSample/Skirt/ABP_Skirt_ExternalForce.uasset differ diff --git a/Plugins/KawaiiPhysics/Source/KawaiiPhysics/Private/KawaiiPhysicsExternalForce.cpp b/Plugins/KawaiiPhysics/Source/KawaiiPhysics/Private/KawaiiPhysicsExternalForce.cpp index ecb7200..f6625fb 100644 --- a/Plugins/KawaiiPhysics/Source/KawaiiPhysics/Private/KawaiiPhysicsExternalForce.cpp +++ b/Plugins/KawaiiPhysics/Source/KawaiiPhysics/Private/KawaiiPhysicsExternalForce.cpp @@ -45,7 +45,7 @@ void FKawaiiPhysics_ExternalForce_Basic::Apply(FKawaiiPhysicsModifyBone& Bone, F } float ForceRate = 1.0f; - if (const auto Curve = ForceRateByLengthRate.GetRichCurve(); !Curve->IsEmpty()) + if (const auto Curve = ForceRateByBoneLengthRate.GetRichCurve(); !Curve->IsEmpty()) { ForceRate = Curve->Eval(Bone.LengthFromRoot / Node.GetTotalBoneLength()); } @@ -116,7 +116,7 @@ void FKawaiiPhysics_ExternalForce_Gravity::Apply(FKawaiiPhysicsModifyBone& Bone, } float ForceRate = 1.0f; - if (const auto Curve = ForceRateByLengthRate.GetRichCurve(); !Curve->IsEmpty()) + if (const auto Curve = ForceRateByBoneLengthRate.GetRichCurve(); !Curve->IsEmpty()) { ForceRate = Curve->Eval(Bone.LengthFromRoot / Node.GetTotalBoneLength()); } @@ -252,7 +252,7 @@ void FKawaiiPhysics_ExternalForce_Curve::Apply(FKawaiiPhysicsModifyBone& Bone, F } float ForceRate = 1.0f; - if (const auto Curve = ForceRateByLengthRate.GetRichCurve(); !Curve->IsEmpty()) + if (const auto Curve = ForceRateByBoneLengthRate.GetRichCurve(); !Curve->IsEmpty()) { ForceRate = Curve->Eval(Bone.LengthFromRoot / Node.GetTotalBoneLength()); } diff --git a/Plugins/KawaiiPhysics/Source/KawaiiPhysics/Public/KawaiiPhysicsExternalForce.h b/Plugins/KawaiiPhysics/Source/KawaiiPhysics/Public/KawaiiPhysicsExternalForce.h index c12a931..c0e8f33 100644 --- a/Plugins/KawaiiPhysics/Source/KawaiiPhysics/Public/KawaiiPhysicsExternalForce.h +++ b/Plugins/KawaiiPhysics/Source/KawaiiPhysics/Public/KawaiiPhysicsExternalForce.h @@ -40,9 +40,17 @@ struct KAWAIIPHYSICS_API FKawaiiPhysics_ExternalForce UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(DisplayPriority=1)) bool bDrawDebug = false; + /** + * 外力を適応するボーンを指定(=指定しなかったボーンには適応しない) + * Specify the bones to which the external force will be applied (= the force will not be applied to bones that are not specified) + */ UPROPERTY(EditAnywhere, meta=(DisplayPriority=1)) TArray ApplyBoneFilter; + /** + * 外力を適応しないボーンを指定 + * Specify the bones to which the external force will be NOT applied + */ UPROPERTY(EditAnywhere, meta=(DisplayPriority=1)) TArray IgnoreBoneFilter; @@ -159,8 +167,14 @@ struct KAWAIIPHYSICS_API FKawaiiPhysics_ExternalForce_Basic : public FKawaiiPhys UPROPERTY(EditAnywhere, BlueprintReadWrite) float ForceScale = 1.0f; + /** + * 各ボーンに適用するForce Rateを補正。 + * 「RootBoneから特定のボーンまでの長さ / RootBoneから末端のボーンまでの長さ」(0.0~1.0)の値におけるカーブの値をForceRateに乗算 + * Corrects the Force Rate applied to each bone. + * Multiplies the ForceRate by the curve value for "Length from RootBone to specific bone / Length from RootBone to end bone" (0.0~1.0) + */ UPROPERTY(EditAnywhere, BlueprintReadWrite) - FRuntimeFloatCurve ForceRateByLengthRate; + FRuntimeFloatCurve ForceRateByBoneLengthRate; UPROPERTY(EditAnywhere, BlueprintReadWrite) float Interval = 0.0f; @@ -190,12 +204,26 @@ struct KAWAIIPHYSICS_API FKawaiiPhysics_ExternalForce_Gravity : public FKawaiiPh UPROPERTY(EditAnywhere, BlueprintReadWrite) float GravityScale = 1.0f; + /** + * 各ボーンに適用するForce Rateを補正。 + * 「RootBoneから特定のボーンまでの長さ / RootBoneから末端のボーンまでの長さ」(0.0~1.0)の値におけるカーブの値をForceRateに乗算 + * Corrects the Force Rate applied to each bone. + * Multiplies the ForceRate by the curve value for "Length from RootBone to specific bone / Length from RootBone to end bone" (0.0~1.0) + */ UPROPERTY(EditAnywhere, BlueprintReadWrite) - FRuntimeFloatCurve ForceRateByLengthRate; + FRuntimeFloatCurve ForceRateByBoneLengthRate; + /** + * Character側で設定されたCustomGravityDirectionを使用するフラグ(UE5.4以降) + * Flag to use CustomGravityDirection set on the Character side (UE5.4 and later) + */ UPROPERTY(EditAnywhere, BlueprintReadWrite) bool bUseCharacterGravityDirection = false; + /** + * Character側で設定されたGravityScaleを使用するフラグ + * Flag to use GravityScale set on the Character side + */ UPROPERTY(EditAnywhere, BlueprintReadWrite) bool bUseCharacterGravityScale = false; @@ -224,12 +252,28 @@ struct KAWAIIPHYSICS_API FKawaiiPhysics_ExternalForce_Curve : public FKawaiiPhys GENERATED_BODY() public: + /** + * 時間に応じて変化する外力をカーブで設定。X軸:Time Y軸:Force + * Set the external force that changes over time using a curve. X-axis: Time Y-axis: Force + */ UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (XAxisName="Time", YAxisName="Force")) FRuntimeVectorCurve ForceCurve; + /** + * カーブの評価方式。 + * Single以外に設定した場合:前フレームからの経過時間をSubstepCountで分割し、 + * 分割後の各時間におけるカーブの値の平均・最大値・最小値を外力として使用 + * Curve evaluation method + * If set to anything other than Single: The time elapsed from the previous frame is divided by SubstepCount, + * and the Average, Maximum, or Minimum values of the curve at each time point after division are used as external forces. + */ UPROPERTY(EditAnywhere, BlueprintReadWrite) EExternalForceCurveEvaluateType CurveEvaluateType = EExternalForceCurveEvaluateType::Single; + /** + * 経過時間の分割数 + * Number of divisions of elapsed time + */ UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(EditCondition="CurveEvaluateType!=EExternalForceCurveEvaluateType::Single")) int SubstepCount = 10; @@ -240,8 +284,14 @@ struct KAWAIIPHYSICS_API FKawaiiPhysics_ExternalForce_Curve : public FKawaiiPhys UPROPERTY(EditAnywhere, BlueprintReadWrite) float ForceScale = 1.0f; + /** + * 各ボーンに適用するForce Rateを補正。 + * 「RootBoneから特定のボーンまでの長さ / RootBoneから末端のボーンまでの長さ」(0.0~1.0)の値におけるカーブの値をForceRateに乗算 + * Corrects the Force Rate applied to each bone. + * Multiplies the ForceRate by the curve value for "Length from RootBone to specific bone / Length from RootBone to end bone" (0.0~1.0) + */ UPROPERTY(EditAnywhere, BlueprintReadWrite) - FRuntimeFloatCurve ForceRateByLengthRate; + FRuntimeFloatCurve ForceRateByBoneLengthRate; private: UPROPERTY()