unity-physicscore2d-math-api

Provides the Unity 6000.5 PhysicsCore2D PhysicsMath API reference with signatures and documentation.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Unity 6000.5's PhysicsCore2D API postdates most AI training data, so code assistants often hallucinate member names or signatures when working with the PhysicsMath type. This Skill supplies the authoritative, auto-generated API surface so generated code compiles against the real API.

Core Features & Use Cases

  • Complete API Reference: Lists every property and method of Unity.U2D.Physics.PhysicsMath with full signatures, parameters, and return values.
  • Deterministic Math Operations: Documents deterministic helpers like Atan2, CosSin, ToRadians, and ToDegrees for cross-platform physics consistency.
  • Transform Plane Conversions: Covers 2D/3D position, rotation, and matrix conversions via ToPosition2D, ToRotationFast3D, Swizzle, and GetRelativeMatrix.
  • Use Case: When writing a Unity 6000.5 script that converts a 3D Transform into a 2D physics pose, consult this Skill to call ToPhysicsTransform with the correct TransformPlane argument instead of guessing the signature.

Quick Start

Ask the AI to write Unity 6000.5 code that converts a Transform to a 2D physics position using the PhysicsMath API reference.

Frequently Asked Questions about unity-physicscore2d-math-api

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

FAQPage Schema
How do I convert a 3D position to 2D in Unity PhysicsCore2D?

Use PhysicsMath.ToPosition2D with the Vector3 position and a PhysicsWorld.TransformPlane argument. An overload also accepts a TransformPlaneCustom for custom projection planes, returning the transformed 2D position.

What is the PhysicsMath class in Unity 6000.5?

PhysicsMath is a static utility type in the Unity.U2D.Physics namespace providing math operations commonly needed for 2D physics, such as deterministic trigonometry, angle conversion, vector swizzling, and transform plane conversions.

Does PhysicsMath support deterministic math across platforms?

Yes, methods like Atan2, ToRadians, and ToDegrees are documented to operate as deterministically as possible across platforms. The PI and TAU properties also provide the internal constants used by the physics system for determinism.

How do I convert a 2D angle to a 3D rotation in Unity 2D physics?

Use PhysicsMath.ToRotationFast3D for a fast single-axis conversion, or ToRotationSlow3D when other rotation axes must be preserved using a reference Quaternion. Both take the angle in radians and a TransformPlane.

When should I not rely on this PhysicsMath reference?

This reference covers only the PhysicsMath type from Unity 6000.5.0b9, so other PhysicsCore2D types like PhysicsWorld or PhysicsBody require their own references. It may also drift from later Unity releases if the API changes.