Skip to main content

UKawaiiPhysicsLibrary

API reference for the Blueprint Function Library.

View Source

Class Definition

UCLASS()
class KAWAIIPHYSICS_API UKawaiiPhysicsLibrary : public UBlueprintFunctionLibrary

Getting Node Reference

ConvertToKawaiiPhysics

Gets KawaiiPhysics reference from AnimNode.

UFUNCTION(BlueprintCallable, Category = "Kawaii Physics",
meta = (BlueprintThreadSafe, ExpandEnumAsExecs = "Result"))
static FKawaiiPhysicsReference ConvertToKawaiiPhysics(
const FAnimNodeReference& Node,
EAnimNodeReferenceConversionResult& Result
);

ConvertToKawaiiPhysicsPure

Gets KawaiiPhysics reference from AnimNode (Pure version).

UFUNCTION(BlueprintPure, Category = "Kawaii Physics",
meta = (BlueprintThreadSafe, DisplayName = "Convert to Kawaii Physics (Pure)"))
static void ConvertToKawaiiPhysicsPure(
const FAnimNodeReference& Node,
FKawaiiPhysicsReference& KawaiiPhysics,
bool& Result
);

Physics Reset

ResetDynamics

Resets the physics state of KawaiiPhysics node.

UFUNCTION(BlueprintCallable, Category = "Kawaii Physics", meta=(BlueprintThreadSafe))
static FKawaiiPhysicsReference ResetDynamics(const FKawaiiPhysicsReference& KawaiiPhysics);

Use Cases:

  • Reset after teleport
  • Animation switching
  • Scene transitions

Bone Settings

SetRootBoneName / GetRootBoneName

Set/get root bone name.

UFUNCTION(BlueprintCallable, Category = "Kawaii Physics", meta=(BlueprintThreadSafe))
static FKawaiiPhysicsReference SetRootBoneName(
const FKawaiiPhysicsReference& KawaiiPhysics,
UPARAM(ref) FName& RootBoneName
);

UFUNCTION(BlueprintPure, Category = "Kawaii Physics", meta=(BlueprintThreadSafe))
static FName GetRootBoneName(const FKawaiiPhysicsReference& KawaiiPhysics);

SetExcludeBoneNames / GetExcludeBoneNames

Set/get exclude bone names.

UFUNCTION(BlueprintCallable, Category = "Kawaii Physics", meta=(BlueprintThreadSafe))
static FKawaiiPhysicsReference SetExcludeBoneNames(
const FKawaiiPhysicsReference& KawaiiPhysics,
UPARAM(ref) TArray<FName>& ExcludeBoneNames
);

UFUNCTION(BlueprintPure, Category = "Kawaii Physics", meta=(BlueprintThreadSafe))
static TArray<FName> GetExcludeBoneNames(const FKawaiiPhysicsReference& KawaiiPhysics);

Physics Settings

SetPhysicsSettings / GetPhysicsSettings

Set/get physics settings.

UFUNCTION(BlueprintCallable, Category = "Kawaii Physics", meta=(BlueprintThreadSafe))
static FKawaiiPhysicsReference SetPhysicsSettings(
const FKawaiiPhysicsReference& KawaiiPhysics,
UPARAM(ref) FKawaiiPhysicsSettings& PhysicsSettings
);

UFUNCTION(BlueprintPure, Category = "Kawaii Physics", meta=(BlueprintThreadSafe))
static FKawaiiPhysicsSettings GetPhysicsSettings(const FKawaiiPhysicsReference& KawaiiPhysics);

SetDummyBoneLength / GetDummyBoneLength

Set/get dummy bone length.

UFUNCTION(BlueprintCallable, Category = "Kawaii Physics", meta=(BlueprintThreadSafe))
static FKawaiiPhysicsReference SetDummyBoneLength(
const FKawaiiPhysicsReference& KawaiiPhysics,
float DummyBoneLength
);

UFUNCTION(BlueprintPure, Category = "Kawaii Physics", meta=(BlueprintThreadSafe))
static float GetDummyBoneLength(const FKawaiiPhysicsReference& KawaiiPhysics);

Teleport Threshold

SetTeleportDistanceThreshold / GetTeleportDistanceThreshold

Set/get teleport distance threshold.

UFUNCTION(BlueprintCallable, Category = "Kawaii Physics", meta=(BlueprintThreadSafe))
static FKawaiiPhysicsReference SetTeleportDistanceThreshold(
const FKawaiiPhysicsReference& KawaiiPhysics,
float TeleportDistanceThreshold
);

UFUNCTION(BlueprintPure, Category = "Kawaii Physics", meta=(BlueprintThreadSafe))
static float GetTeleportDistanceThreshold(const FKawaiiPhysicsReference& KawaiiPhysics);

SetTeleportRotationThreshold / GetTeleportRotationThreshold

Set/get teleport rotation threshold.

UFUNCTION(BlueprintCallable, Category = "Kawaii Physics", meta=(BlueprintThreadSafe))
static FKawaiiPhysicsReference SetTeleportRotationThreshold(
const FKawaiiPhysicsReference& KawaiiPhysics,
float TeleportRotationThreshold
);

UFUNCTION(BlueprintPure, Category = "Kawaii Physics", meta=(BlueprintThreadSafe))
static float GetTeleportRotationThreshold(const FKawaiiPhysicsReference& KawaiiPhysics);

External Forces

SetGravity / GetGravity

Set/get gravity vector.

UFUNCTION(BlueprintCallable, Category = "Kawaii Physics", meta=(BlueprintThreadSafe))
static FKawaiiPhysicsReference SetGravity(
const FKawaiiPhysicsReference& KawaiiPhysics,
FVector Gravity
);

UFUNCTION(BlueprintPure, Category = "Kawaii Physics", meta=(BlueprintThreadSafe))
static FVector GetGravity(const FKawaiiPhysicsReference& KawaiiPhysics);

SetEnableWind / GetEnableWind

Set/get wind enable setting.

UFUNCTION(BlueprintCallable, Category = "Kawaii Physics", meta=(BlueprintThreadSafe))
static FKawaiiPhysicsReference SetEnableWind(
const FKawaiiPhysicsReference& KawaiiPhysics,
bool bEnableWind
);

UFUNCTION(BlueprintPure, Category = "Kawaii Physics", meta=(BlueprintThreadSafe))
static bool GetEnableWind(const FKawaiiPhysicsReference& KawaiiPhysics);

SetWindScale / GetWindScale

Set/get wind scale.

UFUNCTION(BlueprintCallable, Category = "Kawaii Physics", meta=(BlueprintThreadSafe))
static FKawaiiPhysicsReference SetWindScale(
const FKawaiiPhysicsReference& KawaiiPhysics,
float WindScale
);

UFUNCTION(BlueprintPure, Category = "Kawaii Physics", meta=(BlueprintThreadSafe))
static float GetWindScale(const FKawaiiPhysicsReference& KawaiiPhysics);

Collision

SetAllowWorldCollision / GetAllowWorldCollision

Set/get world collision enable setting.

UFUNCTION(BlueprintCallable, Category = "Kawaii Physics", meta=(BlueprintThreadSafe))
static FKawaiiPhysicsReference SetAllowWorldCollision(
const FKawaiiPhysicsReference& KawaiiPhysics,
bool bAllowWorldCollision
);

UFUNCTION(BlueprintPure, Category = "Kawaii Physics", meta=(BlueprintThreadSafe))
static bool GetAllowWorldCollision(const FKawaiiPhysicsReference& KawaiiPhysics);

SetLimitsDataAsset / GetLimitsDataAsset

Set/get collision Data Asset.

UFUNCTION(BlueprintCallable, Category = "Kawaii Physics", meta=(BlueprintThreadSafe))
static FKawaiiPhysicsReference SetLimitsDataAsset(
const FKawaiiPhysicsReference& KawaiiPhysics,
UKawaiiPhysicsLimitsDataAsset* LimitsDataAsset
);

UFUNCTION(BlueprintPure, Category = "Kawaii Physics", meta=(BlueprintThreadSafe))
static UKawaiiPhysicsLimitsDataAsset* GetLimitsDataAsset(const FKawaiiPhysicsReference& KawaiiPhysics);

Warm-up

SetNeedWarmUp / GetNeedWarmUp

Set/get warm-up enable setting.

UFUNCTION(BlueprintCallable, Category = "Kawaii Physics", meta=(BlueprintThreadSafe))
static FKawaiiPhysicsReference SetNeedWarmUp(
const FKawaiiPhysicsReference& KawaiiPhysics,
bool bNeedWarmUp
);

UFUNCTION(BlueprintPure, Category = "Kawaii Physics", meta=(BlueprintThreadSafe))
static bool GetNeedWarmUp(const FKawaiiPhysicsReference& KawaiiPhysics);

External Force API

AddExternalForce

Adds an external force.

UFUNCTION(BlueprintCallable, Category = "Kawaii Physics", meta=(BlueprintThreadSafe))
static bool AddExternalForce(
const FKawaiiPhysicsReference& KawaiiPhysics,
FInstancedStruct& ExternalForce,
UObject* Owner,
bool bIsOneShot = false
);

AddExternalForceWithExecResult

Adds an external force (with execution result).

UFUNCTION(BlueprintCallable, Category = "Kawaii Physics",
meta=(BlueprintThreadSafe, ExpandEnumAsExecs = "ExecResult"))
static FKawaiiPhysicsReference AddExternalForceWithExecResult(
EKawaiiPhysicsAccessExternalForceResult& ExecResult,
const FKawaiiPhysicsReference& KawaiiPhysics,
FInstancedStruct& ExternalForce,
UObject* Owner
);

AddExternalForcesToComponent

Adds external forces to SkeletalMeshComponent.

UFUNCTION(BlueprintCallable, Category = "Kawaii Physics", meta=(BlueprintThreadSafe))
static bool AddExternalForcesToComponent(
USkeletalMeshComponent* MeshComp,
UPARAM(ref) TArray<FInstancedStruct>& ExternalForces,
UObject* Owner,
UPARAM(ref) FGameplayTagContainer& FilterTags,
bool bFilterExactMatch = false,
bool bIsOneShot = false
);

RemoveExternalForcesFromComponent

Removes external forces from SkeletalMeshComponent.

UFUNCTION(BlueprintCallable, Category = "Kawaii Physics", meta=(BlueprintThreadSafe))
static bool RemoveExternalForcesFromComponent(
USkeletalMeshComponent* MeshComp,
UObject* Owner,
UPARAM(ref) FGameplayTagContainer& FilterTags,
bool bFilterExactMatch = false
);

Alpha Control

SetAlphaToComponent

Sets Alpha value to all KawaiiPhysics nodes in the component.

UFUNCTION(BlueprintCallable, Category = "Kawaii Physics", meta=(BlueprintThreadSafe))
static bool SetAlphaToComponent(
USkeletalMeshComponent* MeshComp,
float Alpha,
UPARAM(ref) FGameplayTagContainer& FilterTags,
bool bFilterExactMatch = false
);

GetAlphaFromComponent

Gets Alpha value from the first matching KawaiiPhysics node in the component.

UFUNCTION(BlueprintCallable, Category = "Kawaii Physics", meta=(BlueprintThreadSafe))
static bool GetAlphaFromComponent(
USkeletalMeshComponent* MeshComp,
float& OutAlpha,
UPARAM(ref) FGameplayTagContainer& FilterTags,
bool bFilterExactMatch = false
);

External Force Property Access

SetExternalForceBoolProperty / GetExternalForceBoolProperty

Set/get external force bool property.

UFUNCTION(BlueprintCallable, Category = "Kawaii Physics",
meta=(BlueprintThreadSafe, ExpandEnumAsExecs = "ExecResult"))
static FKawaiiPhysicsReference SetExternalForceBoolProperty(
EKawaiiPhysicsAccessExternalForceResult& ExecResult,
const FKawaiiPhysicsReference& KawaiiPhysics,
int ExternalForceIndex,
FName PropertyName,
bool Value
);

UFUNCTION(BlueprintCallable, Category = "Kawaii Physics",
meta=(BlueprintThreadSafe, ExpandEnumAsExecs = "ExecResult"))
static bool GetExternalForceBoolProperty(
EKawaiiPhysicsAccessExternalForceResult& ExecResult,
const FKawaiiPhysicsReference& KawaiiPhysics,
int ExternalForceIndex,
FName PropertyName
);

Other Type Property Access

The following types are also supported with the same pattern:

  • int32: SetExternalForceIntProperty / GetExternalForceIntProperty
  • float: SetExternalForceFloatProperty / GetExternalForceFloatProperty
  • FVector: SetExternalForceVectorProperty / GetExternalForceVectorProperty
  • FRotator: SetExternalForceRotatorProperty / GetExternalForceRotatorProperty
  • FTransform: SetExternalForceTransformProperty / GetExternalForceTransformProperty
  • Wildcard: SetExternalForceWildcardProperty / GetExternalForceWildcardProperty

Blueprint Usage Example

Reset After Teleport

Event: On Teleport
→ Get Anim Instance from Mesh
→ Get Linked Anim Graph Instance by Tag
→ Get Anim Node By Tag
→ Convert to Kawaii Physics
→ Call ResetDynamics

Apply External Force

Event: On Impact
→ Create External Force (Instanced Struct)
→ Add External Forces to Component
→ Mesh Comp: Self
→ Owner: Self
→ Filter Tags: "KawaiiPhysics.Hair"

C++ Usage Example

#include "KawaiiPhysicsLibrary.h"

void AMyCharacter::OnTeleport()
{
UAnimInstance* AnimInstance = GetMesh()->GetAnimInstance();

// Get node reference and reset
FAnimNodeReference NodeRef = AnimInstance->GetLinkedAnimGraphInstanceByTag("HairPhysics");
EAnimNodeReferenceConversionResult Result;
FKawaiiPhysicsReference KPRef = UKawaiiPhysicsLibrary::ConvertToKawaiiPhysics(NodeRef, Result);

if (Result == EAnimNodeReferenceConversionResult::Succeeded)
{
UKawaiiPhysicsLibrary::ResetDynamics(KPRef);
}
}

void AMyCharacter::ApplyImpact(FVector Direction, float Force)
{
// Add external force
FGameplayTagContainer FilterTags;
FilterTags.AddTag(FGameplayTag::RequestGameplayTag("KawaiiPhysics.Hair"));

TArray<FInstancedStruct> ExternalForces;
// Set up external forces...

UKawaiiPhysicsLibrary::AddExternalForcesToComponent(
GetMesh(),
ExternalForces,
this,
FilterTags
);
}