Logo Ue Physics And Chaos

Ue Physics And Chaos

Cộng đồng
kevinpbuckley
ue-physics-and-chaos

Implement collision, physics simulation, and world queries using Unreal's Chaos physics engine in C++ — collision channels (ECollisionChannel), response types (ECollisionResponse / ECR_Block/Overlap/Ignore), collision presets and profiles, query vs physics collision (ECollisionEnabled), FBodyInstance damping/mass, SetSimulatePhysics, AddForce/AddImpulse, line traces and shape sweeps (LineTraceSingleByChannel, SweepSingleByChannel, OverlapMultiByChannel), FHitResult/FCollisionQueryParams, hit and overlap events (OnComponentHit, OnComponentBeginOverlap), physical materials (UPhysicalMaterial friction/restitution), ragdoll via UPhysicsAsset, and physics constraints (FConstraintInstance, UPhysicsConstraintComponent). Use when setting up what collides with what, creating trigger volumes, doing line/shape traces for aiming or interaction, simulating rigid-body objects, applying forces or impulses, building ragdolls, constraining bodies, or debugging missing hit/overlap events.

Tổng quan

Nhà phát hànhkevinpbuckley
Kho mãunreal-engine-skills
Tên kỹ năngue-physics-and-chaos
Sao
89
Bản fork
9
Tệp đi kèm
3
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 3 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được kevinpbuckley công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Ue Physics And Chaos trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/kevinpbuckley/unreal-engine-skills/tree/master/skills/core/ue-physics-and-chaos
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/kevinpbuckley/unreal-engine-skills.git /tmp/unreal-engine-skills
mkdir -p .claude/skills
cp -r /tmp/unreal-engine-skills/skills/core/ue-physics-and-chaos .claude/skills/ue-physics-and-chaos
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Ue Physics And Chaos trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Ue Physics And Chaos ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Ue Physics And Chaos với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Physics & collision (Chaos)

Chaos is the physics engine in UE. Most gameplay needs three things from it: collision (what blocks/overlaps what), queries (traces/sweeps to ask about the world), and occasionally simulation (rigid bodies, ragdolls, constraints). Collision setup mistakes are the most common source of "my overlap/hit never fires" bugs.

When to use this skill

  • Setting up what collides with what (channels, presets, per-channel responses).
  • Making trigger volumes or detecting overlaps between actors.
  • Line/shape tracing the world (aiming, ground checks, interaction detection).
  • Simulating physics objects — enabling rigid-body physics, applying forces/impulses.
  • Building ragdolls or constraining bodies with UPhysicsConstraintComponent.
  • Debugging "overlap never fires", "trace misses", or "physics not simulating" problems.

Collision model — three controls per component

Every UPrimitiveComponent has three collision controls:

  1. Object type (ECollisionChannel) — what this component is. Built-in: ECC_WorldStatic, ECC_WorldDynamic, ECC_Pawn, ECC_PhysicsBody, ECC_Visibility, ECC_Camera. Custom channels map to ECC_GameTraceChannel1–ECC_GameTraceChannel50 at runtime (expanded from 18 to 50 in 5.8).

  2. Response per channel (ECollisionResponse) — how it reacts to each channel: ECR_Ignore, ECR_Overlap, ECR_Block.

  3. Collision enabled mode (ECollisionEnabled::Type) — what the shape participates in:

    • NoCollision — no physics, no queries.
    • QueryOnly — overlaps/traces; no rigid-body simulation. Best for trigger volumes.
    • PhysicsOnly — rigid-body sim only; traces don't hit it.
    • QueryAndPhysics — both. Default for most simulated objects.

Block requires both sides to set ECR_Block for the other's object type. For overlap events, both sides need ECR_Overlap response and bGenerateOverlapEvents = true.

cpp
// Set up a trigger sphere: query-only, ignore everything except pawns.
Trigger->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
Trigger->SetCollisionObjectType(ECC_WorldDynamic);
Trigger->SetCollisionResponseToAllChannels(ECR_Ignore);
Trigger->SetCollisionResponseToChannel(ECC_Pawn, ECR_Overlap);
Trigger->SetGenerateOverlapEvents(true);

Collision presets bundle object type + responses into a named profile. Apply with SetCollisionProfileName(TEXT("Trigger")) to match a project preset or one defined in Project Settings → Collision. Applying a preset overwrites per-channel overrides, so call any fine-grained SetCollisionResponseToChannel calls after the preset.

See references/collision-channels-and-profiles.md for the full channel list, custom-channel setup, and preset internals.

Hit & overlap events

Bind in BeginPlay (not the constructor — no world available there):

cpp
void AMyActor::BeginPlay()
{
    Super::BeginPlay();
    // Overlap: trigger volume notifying actor entry
    Trigger->OnComponentBeginOverlap.AddDynamic(this, &AMyActor::OnBeginOverlap);
    // Hit: physics body reporting impact
    Mesh->OnComponentHit.AddDynamic(this, &AMyActor::OnHit);
}

// Exact delegate signatures required — see PrimitiveComponent.h:1457,1468
UFUNCTION()
void AMyActor::OnBeginOverlap(UPrimitiveComponent* Comp, AActor* Other,
    UPrimitiveComponent* OtherComp, int32 OtherBodyIndex,
    bool bFromSweep, const FHitResult& Sweep) { /* ... */ }

UFUNCTION()
void AMyActor::OnHit(UPrimitiveComponent* HitComp, AActor* Other,
    UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit) { /* ... */ }

Handlers must be UFUNCTION() — dynamic delegates require UObject reflection. For hit events on simulating bodies, also enable Simulation Generates Hit Events on the body (FBodyInstance::bNotifyRigidBodyCollision). See ue-actors-and-components for delegate binding patterns and ue-delegates-and-events for the delegate system.

Traces & sweeps

cpp
// Line trace — first blocking hit on ECC_Visibility
FHitResult Hit;
FCollisionQueryParams Params(SCENE_QUERY_STAT(MyTrace), /*bTraceComplex=*/false);
Params.AddIgnoredActor(this);   // never hit self

if (GetWorld()->LineTraceSingleByChannel(Hit, GetActorLocation(),
        GetActorLocation() + GetActorForwardVector() * 2000.f, ECC_Visibility, Params))
{
    // Hit.GetActor(), Hit.ImpactPoint, Hit.ImpactNormal, Hit.PhysMaterial
}

// Sphere sweep — shape-based query
FHitResult SweepHit;
GetWorld()->SweepSingleByChannel(SweepHit, Start, End, FQuat::Identity,
    ECC_Pawn, FCollisionShape::MakeSphere(40.f), Params);

// Overlap query — all bodies overlapping a box at a point
TArray<FOverlapResult> Overlaps;
GetWorld()->OverlapMultiByChannel(Overlaps, Center, FQuat::Identity,
    ECC_WorldDynamic, FCollisionShape::MakeBox(FVector(50.f)), Params);

FHitResult fields to know: Time (0–1 along trace), Distance, Location (shape center at contact), ImpactPoint (surface contact), ImpactNormal, GetActor(), GetComponent(), BoneName, PhysMaterial.

Multi-variants (LineTraceMultiByChannel, SweepMultiByChannel) return all overlaps up to and including the first block — useful for bullets through foliage.

See references/traces-and-queries.md for ByObjectType, async traces, UV coordinates from hits, and debug-draw helpers.

Simulating rigid bodies

cpp
// Enable physics simulation — requires simple collision on the mesh asset.
Mesh->SetSimulatePhysics(true);
Mesh->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
Mesh->SetCollisionProfileName(TEXT("PhysicsActor"));

// Mass: override per component or let BodyInstance compute from density/volume.
Mesh->SetMassOverrideInKg(NAME_None, 80.f);

// Forces and impulses (world space by default):
Mesh->AddImpulse(FVector(0.f, 0.f, 600000.f));          // instantaneous kg*cm/s
Mesh->AddForce(FVector(0.f, 0.f, 98000.f));              // continuous N per physics step
Mesh->AddImpulseAtLocation(Impulse, HitPoint);           // torque from off-center

AddForce accumulates over each physics substep; AddImpulse applies once in the current step. Damping is on the FBodyInstance (accessible via GetBodyInstance()): LinearDamping and AngularDamping (both at BodyInstance.h).

Simulating bodies must have simple collision (sphere/box/capsule/convex hull). Complex per-triangle collision cannot drive rigid-body simulation.

Ragdolls and physics assets

A ragdoll runs through a UPhysicsAsset (authored in the Physics Asset Editor), which defines per-bone bodies and constraints for a USkeletalMeshComponent:

cpp
GetMesh()->SetSimulatePhysics(true);                    // whole-body ragdoll
GetMesh()->SetCollisionProfileName(TEXT("Ragdoll"));
// For blended / partial ragdoll, use UPhysicalAnimationComponent.

Physics constraints

UPhysicsConstraintComponent wraps FConstraintInstance and joins two simulated bodies:

cpp
// ConstraintComp is a UPROPERTY(VisibleAnywhere) TObjectPtr<UPhysicsConstraintComponent>
ConstraintComp->SetConstrainedComponents(CompA, NAME_None, CompB, NAME_None);
ConstraintComp->SetLinearXLimit(LCM_Free, 0.f);         // allow X-axis translation
ConstraintComp->SetAngularSwing1Limit(ACM_Limited, 45.f); // 45° swing limit
ConstraintComp->ConstraintInstance.OnConstraintBroken.BindUObject(this,
    &AMyActor::OnConstraintBroken);

BreakConstraint() on the component tears the joint at runtime. FConstraintInstance also supports drives (motors): SetLinearPositionDrive, SetAngularDriveMode.

See references/physics-simulation-and-constraints.md for FBodyInstance details, damping, sub-stepping, and constraint drives.

Physical materials

UPhysicalMaterial (under Runtime/PhysicsCore) stores surface properties referenced by both UStaticMesh and UPrimitiveComponent. Key fields: Friction, StaticFriction, Restitution, Density, SurfaceType (EPhysicalSurface). Assign via the mesh asset or at runtime with GetBodyInstance()->PhysMaterialOverride.

Read SurfaceType from a hit to drive effects (footstep sounds, particle emitters): Hit.PhysMaterial.Get()->SurfaceType.

Collision complexity

ModeUsesSim?Notes
Simpleprimitives / convex hullyesRequired for rigid-body sim; cheap queries
Complexper-trianglenoPrecise static queries (landscape, detailed meshes)

Set per-mesh in the Static/Skeletal Mesh asset collision settings, and optionally override on the component. Use FCollisionQueryParams::bTraceComplex = true to query complex.

Gotchas

  • Overlap never fires — both components need ECR_Overlap response to each other's object type and bGenerateOverlapEvents = true on both. One side being ECR_Block still generates an overlap if the other is ECR_Overlap, but only one fires.
  • Hit event never fires — enable Simulation Generates Hit Events (bNotifyRigidBodyCollision on FBodyInstance); physics sim must also be enabled.
  • Trace misses everything — check ECollisionEnabled on targets; NoCollision or PhysicsOnly makes them invisible to traces.
  • Simulating on complex-collision mesh — physics simulation requires simple collision; complex (per-triangle) collision cannot be simulated.
  • Forgot AddIgnoredActor(this) — trace hits own actor's collision shapes.
  • Handler not UFUNCTION() — AddDynamic silently fails; the method must be a UFUNCTION() with the exact delegate signature.
  • Applying a preset then per-channel overrides — SetCollisionProfileName resets all responses; set per-channel responses after calling it.
  • Force vs. Impulse units — AddForce is Newtons (applied each substep); AddImpulse is kg·cm/s (applied once). Scale accordingly.
  • SetSimulatePhysics(true) silently does nothing — the mesh has no simple collision, or SetCollisionEnabled is NoCollision/QueryOnly.

Version notes

Chaos replaced PhysX as the default physics engine in UE5. The Chaos solver runs deterministic substeps controlled by UPhysicsSettings::AsyncFixed (Project Settings → Physics → Simulation → Use Async Scene). FBodyInstance is stable across UE5; solver internals differ from PhysX but the UPrimitiveComponent API is unchanged.

References & source material

Engine source (UE 5.8, under Engine/Source/):

  • Runtime/Engine/Classes/Engine/EngineTypes.h — ECollisionChannel:1098, ECollisionResponse:1346, ECollisionEnabled:1805, FCollisionResponseContainer:1445.
  • Runtime/Engine/Classes/Engine/HitResult.h — FHitResult:20.
  • Runtime/Engine/Classes/Components/PrimitiveComponent.h — OnComponentHit:1457, OnComponentBeginOverlap:1468, SetGenerateOverlapEvents:418, SetSimulatePhysics:1661, AddImpulse:1692, AddForce:1759, SetCollisionEnabled:2026, SetCollisionProfileName:2036, SetCollisionObjectType:2047, SetCollisionResponseToAllChannels:2952, GetBodyInstance:2337, SetMassOverrideInKg:2857.
  • Runtime/Engine/Classes/PhysicsEngine/BodyInstance.h — LinearDamping:629, AngularDamping:633.
  • Runtime/Engine/Classes/PhysicsEngine/ConstraintInstance.h — FConstraintInstance:254, SetLinearLimits:358, InitConstraint:949.
  • Runtime/Engine/Classes/PhysicsEngine/PhysicsConstraintComponent.h — UPhysicsConstraintComponent:24, BreakConstraint:142, SetLinearPositionDrive:151, SetAngularDriveMode:213.
  • Runtime/Engine/Classes/Engine/World.h — LineTraceSingleByChannel:2161, LineTraceMultiByChannel:2210, SweepSingleByChannel:2286, SweepMultiByChannel:2325, OverlapMultiByChannel:2418.
  • Runtime/Engine/Public/CollisionQueryParams.h — FCollisionQueryParams:42, AddIgnoredActor:243, bTraceComplex:51.
  • Runtime/PhysicsCore/Public/PhysicalMaterials/PhysicalMaterial.h — UPhysicalMaterial:103, Friction:115, Restitution:131, Density:147, SurfaceType:181.

Official docs (UE 5.8):

Deep-dive references in this skill:

Related skills: ue-actors-and-components (component types, overlap wiring), ue-meshes-static-and-skeletal (collision geometry on assets).

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Ue Physics And Chaos làm được gì?

Implement collision, physics simulation, and world queries using Unreal's Chaos physics engine in C++ — collision channels (ECollisionChannel), response types (ECollisionResponse / ECR_Block/Overlap/Ignore), collision presets and profiles, query vs physics collision (ECollisionEnabled), FBodyInstance damping/mass, SetSimulatePhysics, AddForce/AddImpulse, line traces and shape sweeps (LineTraceSingleByChannel, SweepSingleByChannel, OverlapMultiByChannel), FHitResult/FCollisionQueryParams, hit and overlap events (OnComponentHit, OnComponentBeginOverlap), physical materials (UPhysicalMaterial...

Vì sao nên dùng Ue Physics And Chaos trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Ue Physics And Chaos là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Ue Physics And Chaos trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/kevinpbuckley/unreal-engine-skills/tree/master/skills/core/ue-physics-and-chaos. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Ue Physics And Chaos?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Ue Physics And Chaos với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Ue Physics And Chaos với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Ue Physics And Chaos có miễn phí không?

Kỹ năng này được kevinpbuckley phát hành trên GitHub. Hãy xem điều khoản giấy phép trong kho mã. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇