Git Product home page Git Product logo

kawaiiphysics's Introduction

Kawaii Physics

English doc :

ディスカッション:

不具合報告

採用実績

DevCommunity :

はじめに

Kawaii Physicsは UnrealEngine4,5用に作成した疑似物理プラグインです。
髪、スカート、胸などの揺れものを「かんたんに」「かわいく」揺らすことができます。


お借りしたキャラクタ:Gray ちゃん http://rarihoma.xvs.jp/products/graychan


https://www.youtube.com/watch?v=UvpEIBGegvs
お借りしたキャラクタ:ミライ小町 https://www.bandainamcostudios.com/works/miraikomachi/

特徴


  • 元の形状を尊重しつつ、アニメーションやSkeletalMeshComponentの移動・回転を元に物理制御を行います。
  • プラグインに含まれる「KawaiiPhysicsノード」をAnimationBPのAnimGraphで使う形です。
  • 指定したボーンとそれ以下のボーンをキャラクタの動きに合わせて揺らせます。
  • 物理制御用のパラメータは2種類だけなので、エンジン標準のAnimDynamicsに比べて簡単にセットアップできます。
  • 球・カプセル・平面コリジョンを追加することができます
  • アニメーションエディタのビューポート上で各コリジョンの位置・向き・大きさを調整できます
  • 骨の長さを維持するため、仮に計算が破綻しても骨が伸び縮みすることがありません。
  • PhysXは使わずにシンプルなアルゴリズムを使用しているため、エンジン標準の物理システムに比べて負荷が低い(はず)です。

物理挙動を実装するにあたって参考にした資料
次期アイドルマスター グラフィクス&アニメーション プログラミング プレビュー

動作環境

UE4.26以前でビルドする際は、GetSkeleton()をSkeletonに修正する必要があります。

UE4.21以前でビルドする場合は、KawaiiPhysicsEditMode.cpp における
GEngine->ConstraintLimitMaterialPrismatic->GetRenderProxy () を
GEngine->ConstraintLimitMaterialPrismatic->GetRenderProxy (false) に修正する必要があります。

UE4.23以前でビルドする場合は、awaiiPhysics.uplugin における
"Type": "UncookedOnly", を "Type": "DeveloperTool", に修正する必要があります(たぶん)。

使い方

BPプロジェクトをC++プロジェクトに変換するには

「C++ クラス ウィザード」からC++コードを追加することで C++プロジェクトに変換可能です。
https://docs.unrealengine.com/5.0/ja/using-the-cplusplus-class-wizard-in-unreal-engine/

ただし、Visual StudioなどのC++をビルドできる環境を準備する必要があります。
https://docs.unrealengine.com/5.0/ja/setting-up-visual-studio-development-environment-for-cplusplus-projects-in-unreal-engine/

サンプル

内部実装について

その1 http://pafuhana1213.hatenablog.com/entry/2019/07/26/171046

ライセンス

MIT

作者

おかず@pafuhana1213

ハッシュタグ

#KawaiiPhysics

履歴

  • 2024/2/8 v1.14.0
    • 骨間の距離拘束を行う BoneConstraint機能 を実験的に追加しました
      • image
      • 指定した骨間(BoneConstraints/Bone1, 2)の距離を維持しようとします(XPBDを使用)。なお、指定する骨はKawaiiPhysicsの制御対象である必要があります。
      • Bone Constrain Iteration Count Before(After) Collision で拘束処理の実行回数を指定できます(結果を収束させるため)。
      • DataAssetでも設定可能にしました。試験的にDataAssetに正規表現で拘束対象の骨セットを設定できるようにしています。 image
    • KawaiiPhysicsのAnimNodeが持つDataAssetをピンに公開できるようにしました
    • Planar Limitの処理に無駄があったので修正 #108
    • BoneConstraint対応に伴い、物理処理部分のコードをリファクタリング
  • 2023/9/15 v1.13.0
    • 物理の空回し(Warm Up)機能・サンプルを追加しました
      • https://www.youtube.com/watch?v=stIOjZQh3Qw
      • image
      • Need Warm Up が true かつ Warm Up Frame( 空回しするフレーム数 ) が 1以上だと Warm Up 処理が行われます
      • 実行後は Need Warm Upは false になります
      • Warm up Frameが大きいほど安定しますが、物理計算の回数がその分増えるので負荷が上がります
      • image
        v1.12.0から対応したAnimNode関数からWarm Upを有効にすることも可能です
  • 2023/9/8 v1.12.0
    • UE5.3に対応
      • といっても、特に何もしていないです
    • AnimNode関数から各パラメータの変更・取得を可能に
      • image
      • サンプルを追加(AnimBP_GrayChanKawaiiPhysicsAnimNodeFunction)
    • AnimNode関数への対応に伴い、UE4.27のサポートを終了
  • 2023/8/30 v1.11.1
  • 2023/5/28 v1.11.0
    • UE5.2に対応
      • といっても、特に何もしていないです
    • KawaiiPhysicsとSequencerを併用するサンプルを追加
      • SkeletalMeshComponentのAnimClassをAnimBlueprintに設定することと、AnimGraphにSlotノードがあるかを要チェック
    • コンパイルしなくてもプロパティの変更を挙動に反映できるように
      • CopyNodeDataToPreviewNodeの対応が抜けていたので追加
    • UE5.1にてコライダー(~Limits系)のプレビューが上手く動作しない不具合(2つ目以降がコンパイルしないと出てこない)を修正 #84
    • コライダー(~Limits系)の回転を編集したときにクラッシュする事がある不具合を修正 #86
    • DataAssetからのLimitsをDeleteで消した際のクラッシュを修正 #72
    • コライダー(~Limits系)のDrivingBoneに指定しているボーンがLODによって除去された際にクラッシュする不具合を修正 #87
    • Control Rig, AnimationLayer と併用した際のクラッシュを(たぶん)修正 #56
    • サンプルのモデルにLOD1・2を追加しました(動作チェック用)
  • 2022/12/03 v1.10.0
    • UE5.1に対応
    • LODでボーン除去している場合に発生するクラッシュの修正
    • 一部コードをRider様によってリファクタリング
  • 2022/4/11 v1.9.0
    • カーブアセットを作らなくても、カーブでのパラメーター編集ができるようになりました #32
    • ワールドコリジョン機能が入りました。サンプルにも追加してます #26
    • LOD設定などにより末端のボーンが機能しない場合、DummyBoneが生成されない不具合を修正しました #26
    • ResetPhysics時に物理設定がリセットされる不具合を修正しました #38
    • LOD切り替え時のあらぶりを抑える(かもしれない)処理を追加しました。ResetBoneTransformWhenBoneNotFoundを有効にしたら以前の処理に戻ります #44
  • 2022/4/11 v1.8.0
    • UE5正式版に対応
    • UE4.26以下のサポートを一旦切りました。
  • 2020/12/2 v1.7.0
  • 2020/11/17 v.1.6.2
    • FKawaiiPhysicsEditMode::DrawHUDが正常に動作していない不具合を修正
  • 2020/9/4 v1.6.1
    • プロパティのカテゴリ指定忘れによるパッケージ作成エラーの修正
  • 2020/8/29 v1.6.0
    • 専用のDataAsset(KawaiiPhysicsLimitsDataAsset)でコリジョン設定を管理・流用できるようになりました
    • UE4.25.3をデフォルトにしました
  • 2020/7/28 v1.5.3
    • MeshとSkeletonのBoneIndexが違う場合に、正しい長さが取得できなくて、カーブでのパラメータが正常に動作しなくなる不具合修正
      • #21
      • nkinta 様ありがとうございました!
  • 2020/5/29 v1.5.2
    • v1.5.1 における対応がDummyBoneを考慮してなかった不具合の修正
  • 2020/5/29 v1.5.1
  • 2020/5/29 v1.5.0
  • 2020/5/15 v1.4.6
  • 2020/5/15 v1.4.5
    • GravityをComponentSpaceで動作するように変更
      (dxd39 様、ありがとうございました!)
  • 2020/3/13 v1.4.4
    • MacOSでビルドに失敗する不具合の修正
      (melMass 様、ありがとうございました!)
  • 2020/3/13 v1.4.3
    • Package作成に失敗する不具合を修正
  • 2020/2/16 v1.4.2
    • Standalone実行時に正常に動作しない不具合を修正
  • 2020/1/31 v1.4.1
    • SphereLimitのLimitTypeがInnerの場合、Outer設定時に異なりBoneのRadius設定を考慮してなかった不具合の修正
      1.3.1以前の挙動に戻したい方は CVarEnableOldPhysicsMethodSphereLimit を 1 に設定してください
  • 2020/1/31 v1.4.0
    • 重力変数の位置更新の計算がgt^2でなくgtになっていたので修正
      1.3.1以前の重力計算を使用したい場合は p.KawaiiPhysics.EnableOldPhysicsMethodGravity を 1 に設定してください
  • 2020/1/31 v1.3.1
    • TeleportRotationThresholdの計算にてラジアンと度が混在していたことでWorldRotationのテレポート対応がほぼ機能してなかった不具合を修正
      (monguri 様、ありがとうございました!)
  • 2020/1/31 v1.3.0
    • UE4.24.2 に対応
      (TheHoodieGuy02 様、ありがとうございました!)
  • 2019/10/29 v1.2.1
    • World Damping系を従来処理に差し戻し。30fps時の挙動が更に安定しました
      (@seiko_dev 様、ありがとうございました!)
  • 2019/10/26 v1.2.0
    • 簡易可変フレームレート対応。フレームレート低下時の挙動が少し安定するようになったはず
      (@seiko_dev 様、ありがとうございました!)
    • 基準フレームレートを設定できるようにしました(デフォルト:60)(正直テスト不足です。何かあったらissueへ
    • カーブの調整用に各ボーンの始点からの長さの割合をデバッグ表示するようにしました
  • 2019/10/19 v1.1.2
    • BoneのScaleが(1,1,1)以外の環境に対応できてなかったので修正
      (shop-0761様、ありがとうございました!)
  • 2019/9/11 v1.1.1
    • Bone.LengthFromRoot の計算が間違っていたのを修正
      (KazumasaOhashi様、ありがとうございました!)
  • 2019/8/26 v1.1
    • WindDirectionalSourceに対応しました(注意:従来のWind設定に対して破壊的変更が入ります)
  • 2019/7/20 v1.0.1
    • CollisionのOffsetLocationがボーンのRotationを考慮していない不具合の修正
      (v1.0 におけるOffsetLocationの挙動が大きく変化します)
  • 2019/7/2 v1.0 公開 v1.0

kawaiiphysics's People

Contributors

kazumasaohashi avatar makotoichinose avatar mateuszwojt avatar neil3d avatar nkinta avatar pafuhana1213 avatar sam-tak avatar shop-0761 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kawaiiphysics's Issues

SkeletalMeshComponentのAnimationModeを変更するとハングします

検証環境:UE4.26 & UE4.27(Contentフォルダにあるグレイちゃんでも確認)
KawaiiPhysicsバージョン:1.7.0

SkeletalMeshComponentのDetailsにあるAnimationModeを
UseAnimationAssetからUseAnimationBlueprintに変更すると
AnimNode_KawaiiPhysics.cppの37行目のWorldがnullptrでハングします。

image
↑の状態でUseAnimationBlueprintに変更すると症状が発生します。

あまり使わない手順だと思いますが念のため報告いたします。

Bone trembles while using large gravity

We've found that large gravity parameter (z = -5000 for example) will cause bone trembling/shaking.

We wonder if anyone would have any ideas/inputs on this.

Thanks!

Here is the setup:
image

1

P.S.
I think this is what was causing the trembling:

Bone.Location += (BaseLocation - Bone.Location) *  (1.0f - FMath::Pow(1.0f - Bone.PhysicsSettings.Stiffness, Exponent));

When the FPS fluctuates, even if we stand still, we still have the simulated bone pulling in/out of bone pose location (which is given by the animation pose).

Packaging failed due to UnrealEd

UATHelper: Packaging (Windows (64-bit)):   ERROR: Unable to instantiate module 'UnrealEd': Unable to instantiate UnrealEd module for non-editor targets.
UATHelper: Packaging (Windows (64-bit)):          (referenced via Target -> KawaiiPhysicsEd.Build.cs -> AnimGraph.Build.cs -> BlueprintGraph.Build.cs -> KismetCompiler.Build.cs)
PackagingResults: Error: Unable to instantiate module 'UnrealEd': Unable to instantiate UnrealEd module for non-editor targets.
UATHelper: Packaging (Windows (64-bit)): Took 0.9935359s to run UnrealBuildTool.exe, ExitCode=5

データアセット由来のLimitがあるときに選択してウィジェットで位置向きスケールを変えてもデータアセットに変更マークがつきません

件名の操作を行ったとき、
UKawaiiPhysicsLimitsDataAsset::UpdateLimit()でSphericalLimitsなどに変更が入っても、UEエディタ上で
データアセットに変更を示す*マークがつきません。
これは、UKawaiiPhysicsLimitsDataAsset::UpdateLimit()内でModify()メソッドを呼べばつくようです。
(他にもいいやり方があるかもしれません)

SphereLimit、Innerタイプの、コリジョン時のめりこみ解消位置について

SphereLimitに対して、LimitTypeがOuterのときは、コリジョンしたときは
ボーンとSphereLimitの球同士が吸着したような状態まで位置修正していると思います。
一方、LimitTypeがInnerのときは、コリジョンしたときはボーンの位置はSphereLimitの球の表面に位置修正され、ボーンのRadius変数が考慮されません。
Innerと聞いて私がイメージしたのが、ボーンの球がSphereLimitの球の内側に吸着するような位置修正でした。
ただ、これはあくまで個人的な仕様解釈で気になったに過ぎないので、一意見として扱っていただければ幸いです。

BPプロジェクトの場合、Launch, Package起動時に物理が正常に動作しない

BPプロジェクトの場合、エディタのLaunch、または作成したパッケージから起動した場合、Kawaii Physicsの物理が正常に動作しない。C++プロジェクトの場合は正常に動作する。

[2019.07.01-18.54.05:663][  0]LogStreaming: Error: Couldn't find file for package /Script/KawaiiPhysics requested by async loading code. NameToLoad: /Script/KawaiiPhysics
[2019.07.01-18.54.05:663][  0]LogStreaming: Error: Found 1 dependent packages...
[2019.07.01-18.54.05:663][  0]LogStreaming: Error:   /Game/KawaiiPhysicsSample/GrayChan/BP_GrayChan
[2019.07.01-18.54.05:671][  0]LogProperty: Error: Struct type unknown for property 'StructProperty /Game/KawaiiPhysicsSample/GrayChan/AnimBP_GrayChanKawaiiPhysics.AnimBP_GrayChanKawaiiPhysics_C:AnimGraphNode_KawaiiPhysics_2487B5CB4342A26BAE5F1BAF75DD4B4B'; perhaps the USTRUCT() was renamed or deleted?
[2019.07.01-18.54.05:671][  0]LogProperty: Error: Struct type unknown for property 'StructProperty /Game/KawaiiPhysicsSample/GrayChan/AnimBP_GrayChanKawaiiPhysics.AnimBP_GrayChanKawaiiPhysics_C:AnimGraphNode_KawaiiPhysics_FB0984BF430CE5166E4014800979F811'; perhaps the USTRUCT() was renamed or deleted?
[2019.07.01-18.54.05:671][  0]LogProperty: Error: Struct type unknown for property 'StructProperty /Game/KawaiiPhysicsSample/GrayChan/AnimBP_GrayChanKawaiiPhysics.AnimBP_GrayChanKawaiiPhysics_C:PhysicsSettings'; perhaps the USTRUCT() was renamed or deleted?

重力変数の、位置更新の計算がgt^2でなくgt

AnimNode_KawaiiPhysics.cppの重力処理が以下のようになっていました。
// Gravity
// TODO:Migrate if there are more good method (Currently copying AnimDynamics implementation)
Bone.Location += Gravity * DeltaTime;

AnimDynamicsの処理を見たとことろAnimPhysSolver.cppで以下のようになっていました。
FVector Force = InBody->bUseGravityOverride ? (InBody->GravityOverride * InBody->Mass) : (GravityDirection * FMath::Abs(UPhysicsSettings::Get()->DefaultGravityZ) * InBody->Mass * InBody->GravityScale);
InBody->LinearMomentum += Force * DeltaTime;
InBody->NextPosition = InBody->Pose.Position + InBody->LinearMomentum * InBody->InverseMass * DeltaTime;
Gravityに対してはDeltaTimeの2乗を乗算した上で位置の次元の変数に代入するような次元の扱いとなっていました。

どちらであっても、アーティストのGravityの設定次第で同じような動きが達成されると思うので、あくまで私の意見になりますが、タイムステップの2乗になっていた方が自由落下に近い動きをするときによりリアルな動きになるかもしれません。

module ‘KawaiiPhysics’ could not be found,Plugin no longer works

Plugin ‘KawaiiPhysics’ failed to load because module ‘KawaiiPhysics’ could not be found. Please ensure the plugin is properly installed otherwise consider disabling the plugin for this project.

ue4 2.62 2.7 vs2017

It can be used normally in the editor, but the release package will not be available.

4.25から4.26へのアプデについて

はじめまして!
素敵なプラグインをありがとうございます!
愛用させていただいています!

KawaiiPhysicsを導入している4.25のプロジェクトを4.26にバージョンアップしようとした際に、

"The following modules are missing or built with a different engine version:
KawaiiPhysics
KawaiiPhysicsEd
Would you like to rebuild them now?"

と表示され、"はい"を選択しましたところ、

"〇〇〇〇 could not be compiled. Try rebuilding from source manually."

と表示され、起動できませんでした…。

この問題がKawaiiPhysicsの問題なのか、わかりませんでしたので、
この結果になった流れをお伝えさせていただきます。

最初に4.26にバージョンアップさせた際、上記のエラーが出て、
このときは、KawaiiPhysicsのバージョンが1.6.0のままでしたので、
KawaiiPhysics 1.7.0 のzipを解凍し、中身のpluginフォルダにあるKawaiiPhysicsフォルダを
作業プロジェクトのpluginフォルダにあるバージョン1.6.0のKawaiiPhysicsフォルダに上書きしました。

そして、作業プロジェクトを複製して、作業プロジェクト内の"プロジェクト名.uproject"を右クリックし、
"switch unreal engine version"を選び、4.26を選択し起動させてみたところ、
同じエラーが出て、起動ができませんでした…。

お忙しいところ恐縮ですが、
よろしくお願いします。。

WorldRotationのテレポートの判定条件

FAnimNode_KawaiiPhysics::EvaluateSkeletalControl_AnyThread()の以下のコードについて指摘させてください。

if (SkelCompMoveRotation.GetAngle() > TeleportRotationThreshold * TeleportRotationThreshold)
{
	SkelCompMoveRotation = FQuat::Identity;
}

角度の比較なので、TeleportRotationThresholdは2乗する必要がないように思いましたがいかがでしょうか。
また、GetAngle()はラジアン単位で返しますので、TeleportRotationThreshold は度で設定すると思いますので、単位の変換が必要なのではないかと思いました。
今まではラジアンなので小さな値が返っていてこの分岐内に入ることがほとんどなかったのでないかと推測しています。

[Bug Report] WorldDampingRotation not working as intended

Hi pafuhana1213,

I'm reporting a bug here.

The bug:
When rotating my character along z axis, her hair, which is animated by kawaii, appears jittering.

The cause:
In the function SimulateModifyBones, Bone.PrevLocation is updated before its final usage, causing WorldDampingRotation to not work properly.

The fix:
This can be fixed by moving the update of Bone.PrevLocation to the end of the loop.

image

Regards,
Yi

Unreal 5.1 Kawaii Physics BUILD FAILED

Hey guys I have been trying to upgrade Kawaii Physics to 5.1 for the past couple of weeks, had to change some classes because they seem to have changed their method for source objects with TObjectPtr<>

/** Settings for control of physical behavior */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Physics Settings", meta = (PinHiddenByDefault))
FKawaiiPhysicsSettings PhysicsSettings;

/** Curve for adjusting the set value of physical behavior. Use rate of bone length from Root */
UPROPERTY()
TObjectPtr<UCurveFloat> DampingCurve_DEPRECATED = nullptr;

/** Curve for adjusting the set value of physical behavior. Use rate of bone length from Root */
UPROPERTY()
TObjectPtr<UCurveFloat> WorldDampingLocationCurve_DEPRECATED = nullptr;

/** Curve for adjusting the set value of physical behavior. Use rate of bone length from Root */
UPROPERTY()
TObjectPtr<UCurveFloat> WorldDampingRotationCurve_DEPRECATED = nullptr;

/** Curve for adjusting the set value of physical behavior. Use rate of bone length from Root */
UPROPERTY()
TObjectPtr<UCurveFloat> StiffnessCurve_DEPRECATED = nullptr;

/** Curve for adjusting the set value of physical behavior. Use rate of bone length from Root */
UPROPERTY()
TObjectPtr<UCurveFloat> RadiusCurve_DEPRECATED = nullptr;

/** Curve for adjusting the set value of physical behavior. Use rate of bone length from Root */
UPROPERTY()
TObjectPtr<UCurveFloat> LimitAngleCurve_DEPRECATED = nullptr;

Not sure if I did that right but it got rid of those issues for AnimNode_KawaiiPhysics.h

but still, have a couple more issues with something inside the editormoderegistry.h is still seeing it as an abstract class, Not sure how to fix this issue, but would like Kawaii Physics in 5.1 for our project.

I will keep debugging but here is how my last build went
I don't know how to rewrite FKawaiiPhysicseditmode so that it no longer is an abstract class

Severity Code Description Project File Line Suppression State
Error C2259 'FKawaiiPhysicsEditMode': cannot instantiate abstract class KawaiiUpgrade X:\ProgramFiles\EpicGames\UnrealEngine-5.1\Engine\Source\Editor\UnrealEd\Public\EditorModeRegistry.h 125

I'm stuck there if anyone could help I am new to c++, I know it has to do with calling the base

class FKawaiiPhysicsEditMode : public FKawaiiPhysicsEditModeBase
{
public:
FKawaiiPhysicsEditMode();
/** IAnimNodeEditMode interface /
virtual void EnterMode(class UAnimGraphNode_Base
InEditorNode, struct FAnimNode_Base* InRuntimeNode) override;
virtual void ExitMode() override;
virtual FVector GetWidgetLocation() const override;
virtual UE_WIDGET::EWidgetMode GetWidgetMode() const override;
virtual ECoordSystem GetWidgetCoordinateSystem() const override;
virtual void DoTranslation(FVector& InTranslation) override;
virtual void DoRotation(FRotator& InRotation) override;
virtual void DoScale(FVector& InScale) override;

/** FEdMode interface */
virtual void Render(const FSceneView* View, FViewport* Viewport, FPrimitiveDrawInterface* PDI) override;
virtual bool HandleClick(FEditorViewportClient* InViewportClient, HHitProxy* HitProxy, const FViewportClick& Click) override;
virtual bool GetCustomDrawingCoordinateSystem(FMatrix& InMatrix, void* InData) override;
virtual bool InputKey(FEditorViewportClient* InViewportClient, FViewport* InViewport, FKey InKey, EInputEvent InEvent) override;
virtual bool ShouldDrawWidget() const override;
virtual void DrawHUD(FEditorViewportClient* ViewportClient, FViewport* Viewport, const FSceneView* View, FCanvas* Canvas) override;

Can someone tell me how to rewrite this?

Module type of KawaiiPhysicsEd causes standalone development build to fail

If the game is run in standalone (development build) the KawaiiPhysicsEd module will be missing and the animation blueprint will break. (log will complain about the missing module) We found the issue to be related to the module type being set to EditorNoCommandlet. The plugin is still working in PIE and release builds however.

{    "Name": "KawaiiPhysicsEd",    "Type": "EditorNoCommandlet",    "LoadingPhase": "PreDefault" }

We fixed this in our project by setting the module type to DeveloperTool. Now it works in all builds.

{    "Name": "KawaiiPhysicsEd",    "Type": "DeveloperTool",    "LoadingPhase": "PreDefault" }

We believe this is related to standalone development builds needing access to animgraphnodes for debugging.

データアセット由来のLimitがあるときに選択してDeleteキーを押すとクラッシュの可能性があります。

FKawaiiPhysicsEditMode::InputKey()の実装ですが、

		else if (InKey == EKeys::Delete && IsValidSelectCollision())
		{
			switch (SelectCollisionType)
			{
			case ECollisionLimitType::Spherical:
				RuntimeNode->SphericalLimits.RemoveAt(SelectCollisionIndex);
				GraphNode->Node.SphericalLimits.RemoveAt(SelectCollisionIndex);
				break;
			case ECollisionLimitType::Capsule:
				RuntimeNode->CapsuleLimits.RemoveAt(SelectCollisionIndex);
				GraphNode->Node.CapsuleLimits.RemoveAt(SelectCollisionIndex);
				break;
			case ECollisionLimitType::Planar:
				RuntimeNode->PlanarLimits.RemoveAt(SelectCollisionIndex);
				GraphNode->Node.PlanarLimits.RemoveAt(SelectCollisionIndex);
				break;
			case ECollisionLimitType::None: break;
			default: ;
			}
		}

となっていますが、SelectCollisionIsFromDataAsset による分岐をしていないため、
SphericalLimitsDataの方にLimitがあって、そちらを選択してるときにDeleteボタンを押すと
空のSphericalLimitsに対してRemoveAt()が走り、クラッシュする、ということが起きそうです。
こちらでもSelectCollisionIsFromDataAssetによる分岐をすれば解決すると思います。

Damping and world damping is framerate dependent

The world damping values get run every frame, so the higher the framerate the more dampening that happens (most noticeable with long bone chains). At lower FPS it will be more bouncy, but as you increase the max FPS it becomes less bouncy and just goes straight, making the physics not look as good.
Heres a video example showing what I mean, can see it the most in the tail

Editor.77.mp4

I have found a possible fix but isn't the best implementation to target how it looks at a specific FPS.
This is what I did to make it consistent across all framerate unless its lower than target fps, the edit is in "AnimNode_KawaiiPhysics.cpp" (and "AnimNode_KawaiiPhysics.h" to add cumulativeDeltaTime to each bone, had issues if not all bones had their own value for some reason), for some reason though this code randomly stops working for some physics nodes, maybe because I don't know much about C++. (I tried using delta time but couldn't figure out how to get it to work well)
image

Spherical, Capsule, Planar Limits - small enhancement request

Currently Spherical, Capsule, Planar Limits Offset Location and Rotation can be driving only by bone.
My enhancement request is being able to set them as well in "External Force" or maybe keep it in same place. This will help to interact with the outside forces.

To show that idea I did create picture with photoshop.

kawaii

ありがとうございました

Crash in void FKawaiiPhysicsEditMode::OnExternalNodePropertyChange (and simple fix)

Hi @pafuhana1213 ,

We are experiencing a crash in the first line of the method FKawaiiPhysicsEditMode::OnExternalNodePropertyChange.

void FKawaiiPhysicsEditMode::OnExternalNodePropertyChange(FPropertyChangedEvent& InPropertyEvent)
{
	USkeletalMeshComponent* SkelComponent = GetAnimPreviewScene().GetPreviewMeshComponent();

	if (!IsValidSelectCollision())
	{
		SelectCollisionIndex = -1;
		SelectCollisionType = ECollisionLimitType::None;
		CurWidgetMode = UE_WIDGET::EWidgetMode::WM_None;
	}
}

We have debugged the issue and it happens because the Owner does not contain a valid FAssetEditorModeManager instance.

IPersonaPreviewScene& FKawaiiPhysicsEditModeBase::GetAnimPreviewScene() const
{
	return *static_cast<IPersonaPreviewScene*>(static_cast<FAssetEditorModeManager*>(Owner)->GetPreviewScene());
}

As the variable SkelComponent is not used in the method (and the calls to to get the variable do not have side effects) we managed to fix the crash simply removing the first line.

You can reproduce the crash doing the following operations in the anim graph view:

  • open animation layer asset A
  • select a kawaii node N and update any property (make sure that the node is being used to compute the final pose)
  • compile asset A
  • close asset A
  • open asset A again
  • select the same kawaii node and update the same property
  • compile asset A
  • observe the crash

Best regards,

Sergi

Master Pose Component

I am trying to create modular parts for hair, skirts etc. At this moment all parts sharing same skeleton and also animation blueprints but setting this to "SetMasterComponent" makes kawaii plugin to do not work?

Physics settings lost after ResetDynamics called

After calling ResetDynamics, all the bones reset their settings (eg. Damping, Radius, Stiffness, LimitAngle).

In FAnimNode_KawaiiPhysics::EvaluateSkeletalControl_AnyThread, the ModifyBones array is cleared, if bResetDynamics is true, but UpdatePhysicsSettingsOfModifyBones is not called, unless bUpdatePhysicsSettingsInGame is specified.
I suggest calling UpdatePhysicsSettingsOfModifyBones after the dynamics was reset.

KawaiiPhysicsプラグインrebuildについて

はじめまして須田と申します。
UE4.26.2では問題なくビルドして使えています。
UE4.26.2 for Aximmetryと言うAximmetry版Unreal Editorがあり
こちらでビルトすると下記のようなエラーが出てしまいビルト出来ません。

"KawaiiPhysicsSample could not be compiled. Try rebuilding from source manually."

ログファイルを見てみると
Running C:/Program Files/Aximmetry DE/UnrealEngine/Engine/Binaries/DotNET/UnrealBuildTool.exe Development Win64 -Project="C:/Users/user/Desktop/test/KawaiiPhysics-master/KawaiiPhysicsSample.uproject" -TargetType=Editor -Progress -NoEngineChanges -NoHotReloadFromIDE
ERROR: Unable to find target of type 'Editor' for project 'C:\Users\user\Desktop\test\KawaiiPhysics-master\KawaiiPhysicsSample.uproject'
と言うエラーが出ているのですが自力で解決できず質問いたしました。

Aximmetry版のUnrealと言うことで少し特殊な件ではありますが
何か心当たりがあればアドバイスなど頂けると助かります。。。

ver1.6.0 でパッケージ作成に失敗する

①:サードパーソンテンプレートをデフォルト設定のまま作成
②:kawaii physics をonにして再起動
③:win64向けにパッケージをビルド

エラー内容
Files/Epic Games/UE_4.25/Engine/Plugins/KawaiiPhysics/Source/KawaiiPhysics/Public/AnimNode_KawaiiPhysics.h(77) : LogCompile: Error: An explicit Category specifier is required for any property exposed to the editor or Blueprints in an Engine module.
UATHelper: パッケージ化 (Windows (64-bit)): D:/Program Files/Epic Games/UE_4.25/Engine/Plugins/KawaiiPhysics/Source/KawaiiPhysics/Public/KawaiiPhysicsLimitsDataAsset.h(27) : LogCompile: Error: An explicit Category specifier is required for any property exposed to the editor or Blueprints in an Engine module.
UATHelper: パッケージ化 (Windows (64-bit)): D:/Program Files/Epic Games/UE_4.25/Engine/Plugins/KawaiiPhysics/Source/KawaiiPhysics/Public/KawaiiPhysicsLimitsDataAsset.h(30) : LogCompile: Error: An explicit Category specifier is required for any property exposed to the editor or Blueprints in an Engine module.
UATHelper: パッケージ化 (Windows (64-bit)): D:/Program Files/Epic Games/UE_4.25/Engine/Plugins/KawaiiPhysics/Source/KawaiiPhysics/Public/KawaiiPhysicsLimitsDataAsset.h(33) : LogCompile: Error: An explicit Category specifier is required for any property exposed to the editor or Blueprints in an Engine module.
UATHelper: パッケージ化 (Windows (64-bit)): D:/Program Files/Epic Games/UE_4.25/Engine/Plugins/KawaiiPhysics/Source/KawaiiPhysics/Public/KawaiiPhysicsLimitsDataAsset.h(129) : LogCompile: Error: An explicit Category specifier is required for any property exposed to the editor or Blueprints in an Engine module.

4.27?

Hello, I'm having a little trouble upgrading the plugin to version 4.27, would it be possible to update the plugin please?

Package error 4.26

Gives out an error when trying to pack a project in engine version 4.26. I put the plugin on a clean project.

骨の位置がコリジョンの中心にあるときに押し出されない

AnimBP_ChainKawaiiPhysicsCollision1 で見られる現象ですが、
骨の位置がカプセルの**にあるので押し出し方向が決まらずに押し出されないというのがあります。
ご認識済みで、押し出し方向が勝手に決まらないように意図している仕様であればすみません。

これは、
FAnimNode_KawaiiPhysics::AdjustBySphereCollision()やFAnimNode_KawaiiPhysics::AdjustByCapsuleCollision()で
GetSafeNormal()が、0ベクトルに対しては0べクトルを返すところから来ています。
勝手な方向に押し出すのも問題ですし難しいところかと思います。
少しでもモーションしていればほぼ発生しないめりこみですし、このままの仕様でも問題ないとは思っております。

Kawaii Physics collision with two separate skeletal mesh

I decided to have hair and body as separate skeletal mesh. Kawaii Physics worked perfectly fine when I had my hair as part of body mesh but I can’t figure out how to add collision so that the separate hair mesh does not penetrate body mesh. The hair mesh penetrates the body mesh because the kawaii physics of the hair skeletal mesh does not have any bones that can be used as root bones of the collision capsule/plane. In AnimGraph there is an option to add additional skeletal mesh to preview scene and I can somewhat use that to draw the collision spheres but because animBP obviously doesn’t recognise them as part of the skeleton the spheres are not linked to bones and will always stay in T-pose no matter what animation is being played. Is there any way to make this work using Kawaii Physics? Any ideas would be very much appreciated. Thank you in advance!

UE5 official release

Everything was working well with UE5 Preview 1 and Preview 2 but with the official release today, Unreal is not able to open kawaii Physics anymore. Anyone got an idea?

Screenshot_82
Screenshot_81

Limits Data Asset not showing for UE5 Projects

Limits Data Asset is not showing any kind of information in any UE5 project.
You're able to create one. Once it's open though, there is no information showing to add the Capsule/Sphere/Planar limits.

It looks like it's working properly on UE4 projects though.

001
002

Please help!

1
[UE4 version is 4.26]
KawaiiPhysics is in my project’s plugin
How can i fixed it?
Please help me!

Capsule limit

The bone still swing pass the limit when character move fast
if there are kinds of fake physic lock like vertical/horizontal x/y/z only
I think it will easier to adjust some move that don't need or out of the plan
thank you

Kawaii physics does not work with control rig.

Hello i love kawaii physics and i would love to use it in my animations. But im having an issue with using kawaii physics in conjunction with control rig. upon adding the anim class blueprint to the skeletal mesh i get this crash:

LoginId:98aff43c4d60f4c49e90919af69e46f1
EpicAccountId:3121102b2e164b4fa074f16cc163618a

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x00000000000000b8

UnrealEditor_KawaiiPhysics!FAnimNode_KawaiiPhysics::Initialize_AnyThread() [F:\Github\KawaiiPhysics\Plugins\KawaiiPhysics\Source\KawaiiPhysics\Private\AnimNode_KawaiiPhysics.cpp:36]
UnrealEditor_Engine
UnrealEditor_AnimGraphRuntime
UnrealEditor_KawaiiPhysics!FAnimNode_KawaiiPhysics::Initialize_AnyThread() [F:\Github\KawaiiPhysics\Plugins\KawaiiPhysics\Source\KawaiiPhysics\Private\AnimNode_KawaiiPhysics.cpp:22]
UnrealEditor_Engine
UnrealEditor_AnimGraphRuntime
UnrealEditor_KawaiiPhysics!FAnimNode_KawaiiPhysics::Initialize_AnyThread() [F:\Github\KawaiiPhysics\Plugins\KawaiiPhysics\Source\KawaiiPhysics\Private\AnimNode_KawaiiPhysics.cpp:22]
UnrealEditor_Engine
UnrealEditor_AnimGraphRuntime
UnrealEditor_KawaiiPhysics!FAnimNode_KawaiiPhysics::Initialize_AnyThread() [F:\Github\KawaiiPhysics\Plugins\KawaiiPhysics\Source\KawaiiPhysics\Private\AnimNode_KawaiiPhysics.cpp:22]
UnrealEditor_Engine
UnrealEditor_AnimGraphRuntime
UnrealEditor_KawaiiPhysics!FAnimNode_KawaiiPhysics::Initialize_AnyThread() [F:\Github\KawaiiPhysics\Plugins\KawaiiPhysics\Source\KawaiiPhysics\Private\AnimNode_KawaiiPhysics.cpp:22]
UnrealEditor_Engine
UnrealEditor_AnimGraphRuntime
UnrealEditor_KawaiiPhysics!FAnimNode_KawaiiPhysics::Initialize_AnyThread() [F:\Github\KawaiiPhysics\Plugins\KawaiiPhysics\Source\KawaiiPhysics\Private\AnimNode_KawaiiPhysics.cpp:22]
UnrealEditor_Engine
UnrealEditor_AnimGraphRuntime
UnrealEditor_KawaiiPhysics!FAnimNode_KawaiiPhysics::Initialize_AnyThread() [F:\Github\KawaiiPhysics\Plugins\KawaiiPhysics\Source\KawaiiPhysics\Private\AnimNode_KawaiiPhysics.cpp:22]
UnrealEditor_Engine
UnrealEditor_AnimGraphRuntime
UnrealEditor_KawaiiPhysics!FAnimNode_KawaiiPhysics::Initialize_AnyThread() [F:\Github\KawaiiPhysics\Plugins\KawaiiPhysics\Source\KawaiiPhysics\Private\AnimNode_KawaiiPhysics.cpp:22]
UnrealEditor_Engine
UnrealEditor_AnimGraphRuntime
UnrealEditor_KawaiiPhysics!FAnimNode_KawaiiPhysics::Initialize_AnyThread() [F:\Github\KawaiiPhysics\Plugins\KawaiiPhysics\Source\KawaiiPhysics\Private\AnimNode_KawaiiPhysics.cpp:22]
UnrealEditor_Engine
UnrealEditor_AnimGraphRuntime
UnrealEditor_KawaiiPhysics!FAnimNode_KawaiiPhysics::Initialize_AnyThread() [F:\Github\KawaiiPhysics\Plugins\KawaiiPhysics\Source\KawaiiPhysics\Private\AnimNode_KawaiiPhysics.cpp:22]
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_ControlRig
UnrealEditor_Engine
UnrealEditor_ControlRig
UnrealEditor_ControlRig
UnrealEditor_ControlRig
UnrealEditor_ControlRig
UnrealEditor_MovieScene
UnrealEditor_MovieScene
UnrealEditor_MovieScene
UnrealEditor_MovieScene
UnrealEditor_MovieScene
UnrealEditor_MovieScene
UnrealEditor_MovieScene
UnrealEditor_MovieScene
UnrealEditor_Sequencer
UnrealEditor_Sequencer
UnrealEditor_UnrealEd
UnrealEditor_UnrealEd
UnrealEditor_UnrealEd
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
kernel32
ntdll

Is kawaii physics not compatible with control rig? Is there any workaround? Using UE 5.02

PlaneLimitに対し、初期位置でPlaneに潜っていたときや、高速移動で潜ってしまったときは潜りっぱなしになる

仕様に関する質問です。
AnimBP_ChainKawaiiPhysicsCollision2を見ると、チェインが何も動いてなければ先の方のチェインはPlaneLimitに潜りっぱなしになります。

これは、FAnimNode_KawaiiPhysics::AdjustByPlanerCollisionにおいて、
FMath::SegmentPlaneIntersection(Bone.Location, Bone.PrevLocation, Planar.Plane, IntersectionPoint)
がtrueを返すときのみ押し出し処理をするというところから来ている挙動だと思います。

これは仕様として想定している挙動かどうかを伺いたいです。
ゲーム用途ですと何かのきっかけで潜ってしまっても押し出してほしいケースが多いと思いますし、
もし仮にPlaneを片面押し出しでなく両面に対して隔てる壁と捉えていれば、GetUpVector()の方向だけでなく、
逆方向にも押し出し処理がほしい感じはします。
ただ、現在の挙動の方が、KawaiiPhysicsSampleマップのようにチェインが左右に引っ張られるケースでは、潜っていたチェインがすべていきなり1フレームで飛び出すのでなく、PlaneLimitと交差したもののみ押し出されるので、急激に動くことがないというメリットはあると感じます。
なので、仕様であっても問題はなく、今回は確認させていただきたかっただけとなります。

Planar Constraintの挙動のバグ?について

Planar Constraintを使って、回転するボーンの方向を制限しようとしているのですが、CharacterのYawが180°回転をすると、逆向きに揺れるようになってしまいます。

out.mp4

動画では、ポニーテールに適用しています。

UE4.27.2
v1.9.0

Reset bone location and rotation may cause trouble when switching between skeleton LODs

//@struct FKawaiiPhysicsModifyBone
void UpdatePoseTranform(const FBoneContainer& BoneContainer, FCSPose<FCompactPose>& Pose)
{
	auto CompactPoseIndex = BoneRef.GetCompactPoseIndex(BoneContainer);
	if (CompactPoseIndex < 0)
	{
		PoseLocation = FVector::ZeroVector;
		PoseRotation = FQuat::Identity;
		PoseScale = FVector::OneVector;
		return;
	}

	auto ComponentSpaceTransform = Pose.GetComponentSpaceTransform(CompactPoseIndex);
	PoseLocation = ComponentSpaceTransform.GetLocation();
	PoseRotation = ComponentSpaceTransform.GetRotation();
	PoseScale = ComponentSpaceTransform.GetScale3D();
}

Bone motion is too large when switching LOD.
When CompactPoseIndex < 0, maybe just keeping the information saved before works well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.