unity-physicscore2d-shapes-api

Documents the Unity 6000.5 PhysicsCore2D PhysicsShape and PhysicsShapeDefinition API surface.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Unity 6000.5's PhysicsCore2D API post-dates most AI training data, so code assistants often hallucinate member names or signatures when working with 2D physics shapes. This Skill provides an authoritative, auto-generated reference for PhysicsShape and PhysicsShapeDefinition so generated code matches the real API.

Core Features & Use Cases

  • Complete API Reference: Lists every property, field, method signature, parameter, and return value for PhysicsShape and PhysicsShapeDefinition, generated from Unity 6000.5.0b9 documentation XML.
  • Nested Type Coverage: Documents nested types such as Contact, ContactFilter, ContactManifold, ShapeProxy, ShapeType, and SurfaceMaterial.
  • Use Case: When writing a Unity script that creates a capsule shape, sets its friction and contact filter, and queries contacts, consult this Skill to get exact member names like CreateShape, contactFilter, and GetContacts instead of guessing.

Quick Start

Ask the AI to write Unity PhysicsCore2D code that creates a circle shape on a body and configures its collision filtering, and it will use this reference for correct API calls.

Frequently Asked Questions about unity-physicscore2d-shapes-api

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

FAQPage Schema
How do I create a physics shape in Unity PhysicsCore2D?

Use the static PhysicsShape.CreateShape methods, passing a PhysicsBody, a geometry such as CircleGeometry or CapsuleGeometry, and optionally a PhysicsShapeDefinition. Batch creation is available via CreateShapeBatch for multiple shapes at once.

What is PhysicsShapeDefinition used for in Unity 2D physics?

PhysicsShapeDefinition bundles the initial properties of a shape, such as friction, bounciness, contact filter, and trigger state, so they can be applied at creation time. It avoids setting each property individually after the shape exists.

Does PhysicsCore2D support collision filtering between shapes?

Yes, PhysicsShape.ContactFilter controls which contacts are created using category masks, contact masks, and a group index. The CanContact method checks whether two filters would produce a contact.

How do I get contacts for a shape in Unity 6000.5 2D physics?

Call GetContacts with a Unity Collections allocator to retrieve all touching contacts for the shape. The returned NativeArray must be disposed after use to avoid memory leaks.

What shape types does the Unity PhysicsCore2D API support?

The ShapeType enumeration covers Circle, Capsule, Polygon, Segment, and Chain Segment shapes. Closed shapes like circles and polygons have interiors that produce contacts, while open shapes like segments only produce contacts on their boundary.