How pafuhana1213/kawaiiphysics works
Project Type and Purpose
• This is an Unreal Engine C++ plugin (“KawaiiPhysics”) bundled with a sample Unreal project (“KawaiiPhysicsSample”).
• Purpose: provide a lightweight, PhysX-independent pseudo-physics system for animating “kawaii” elements (hair, skirt, etc.) via a custom AnimNode in the UE animation pipeline.
File Structure Analysis
• Top-level directories:
• Config: engine/project INI settings
• Content: sample maps, assets, blueprints under Content/KawaiiPhysicsSample
• Plugins: contains the KawaiiPhysics plugin
• Plugins/KawaiiPhysics:
• KawaiiPhysics.uplugin (metadata)
• Source/KawaiiPhysics: runtime module (Public/Private, Build.cs)
• Source/KawaiiPhysicsEd: editor module (graph node, edit mode)
• Sample project files: .uproject, LICENSE, README, .gitignore
Key Insights from README
• Two modules: Runtime and Editor
• Integrates via an AnimGraph node (KawaiiPhysics)
• Uses DataAssets and existing PhysicsAssets for parameter storage
• Supports external forces, collisions (sphere/capsule/plane), stable simulation
• Sample content under Content/KawaiiPhysicsSample demonstrates usage
Components
a. Unreal Engine Core
– Animation Subsystem (AnimGraph execution)
– Asset Management Subsystem (DataAsset, PhysicsAsset loading)
b. KawaiiPhysics Plugin
– Runtime Module (KawaiiPhysics.dll)
• AnimNode_KawaiiPhysics (C++ class)
• Physics algorithm library (KawaiiPhysicsLibrary)
• External force/constraints handlers
– Editor Module (KawaiiPhysicsEd.dll)
• AnimGraph node UI (AnimGraphNode_KawaiiPhysics)
• Edit-mode tools (KawaiiPhysicsEditMode)
c. Project Content
– Sample levels and assets (skeletal meshes, skeletons, materials under Content/KawaiiPhysicsSample)
– Blueprints (BP_Skirt, BP_GC_ExternalForce, sample game mode)
d. Data Stores
– DataAsset (BoneConstraintsDataAsset, LimitsDataAsset)
Relationships and Data Flows
1. At load time, UE Engine loads the plugin modules (Runtime & Editor).
2. Editor Module registers the AnimGraph node; user drags “KawaiiPhysics” node into Blueprint AnimGraph.
3. At runtime, SkeletalMeshComponent triggers the AnimGraph evaluation.
4. AnimNode_KawaiiPhysics reads:
– Current bone transforms (from animation pose)
– Parameters (from DataAsset or default node parameters)
5. AnimNode invokes the physics algorithm (computed in KawaiiPhysicsLibrary)
6. New bone transforms are output back to the AnimGraph, blending into final pose
7. If ExternalForces or AnimNotifies are defined, they feed into the algorithm each tick
Architectural Patterns & Principles
• Modular plugin architecture: separate Editor vs. Runtime responsibilities.
• Data-driven design: parameters in DataAssets and PhysicsAssets.
• Single-responsibility AnimNode: encapsulates physics calculation.
• Lightweight algorithm to prevent skeleton distortion, independent of PhysX.