unity-physicscore2d-factories

Implements factory patterns for creating ragdolls, soft bodies, vehicles, and gears in Unity PhysicsCore2D.

735|105|Updated Mar 4, 2017
One-click install
npx skills add https://github.com/Unity-Technologies/PhysicsExamples2D --skill unity-physicscore2d-factories
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: unity-physicscore2d-factories
Source: https://github.com/Unity-Technologies/PhysicsExamples2D/tree/main/.claude/skills/unity-physicscore2d-factories
Command: npx skills add https://github.com/Unity-Technologies/PhysicsExamples2D --skill unity-physicscore2d-factories

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Building complex multi-body physics objects in Unity's PhysicsCore2D API (Unity.U2D.Physics) requires repetitive, error-prone code for creating bodies, shapes, and joints; this Skill provides proven factory patterns that encapsulate that creation logic.

Core Features & Use Cases

  • Ragdoll Factory: Assemble articulated characters from capsule bodies connected by hinge joints with angle limits and negative-group collision filtering.
  • Soft Body Factory: Create deformable ring/blob objects from capsule segments joined by compliant fixed joints with tunable frequency and damping.
  • Vehicle Factory: Build wheeled vehicles with chassis, wheel bodies, and wheel joints featuring motors, spring suspension, and travel limits.
  • Use Case: Ask the assistant to create a drivable 2D car in a Unity PhysicsCore2D scene, and it will generate a VehicleFactory with chassis, two wheels, motorized wheel joints, and a MonoBehaviour demo wired to arrow-key input.

Quick Start

Use the unity-physicscore2d-factories skill to create a ragdoll factory that spawns an articulated stick figure in my PhysicsCore2D scene.

Frequently Asked Questions about unity-physicscore2d-factories

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a ragdoll in Unity PhysicsCore2D?

Create a ragdoll by building capsule bodies for each body part and connecting them with PhysicsHingeJoint joints that have angle limits. Use a negative groupIndex in the contact filter so ragdoll parts never collide with each other.

How to make a soft body with Unity.U2D.Physics?

Arrange capsule bodies in a ring and connect adjacent pairs with PhysicsFixedJoint joints configured with angularFrequency and angularDamping for spring-like compliance. The negative groupIndex filter prevents the ring's own segments from colliding inward.

How do I build a 2D car with wheel joints in Unity PhysicsCore2D?

Create a polygon chassis body and two circle wheel bodies, then attach them with PhysicsWheelJoint definitions enabling a motor, spring suspension (springFrequency and springDamping), and translation limits. Set motorSpeed at runtime to drive the vehicle.

Why do my ragdoll limbs collide with each other in Unity physics?

Self-collision happens when body parts share the same collision group. Assign a negative groupIndex in the PhysicsShape.ContactFilter so all parts in that group never collide with each other while still colliding with the world.

When should I use a factory pattern for Unity physics objects?

Use a factory when an object requires multiple bodies, shapes, and joints created in a coordinated sequence, such as ragdolls, vehicles, or soft bodies. The factory centralizes configuration, returns a struct with a Destroy method, and keeps creation logic reusable and testable.