Index of every page on this site: llms.txt
All skills
oahc09 avatar

/cocosair-physics

@ed38648
by oahc09oahc09/cocosairjs3 stars
2
Run it yourself

Choose builtin, cannon or Box2D physics; wire rigid bodies, colliders and raycasts. Use for missing gravity, trigger filters, backend limits or material error 9642.

  • 9 files
  • 37.8 KB
  • MIT
  • Updated last month
  • GitHub
Use this Skill: https://skilld.dev/gh/oahc09/cocosairjs/cocosair-physics

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencescontext.md

≈1.2k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Working context

Use package imports and shipped docs for an application; use source paths and repository commands only in a confirmed AIR checkout. A copied host skill is not a runtime installation.

Read the shared environment rules when locating these roots. If sibling resources are unavailable, use the installed canonical chapter and disclose the limitation. Tool declarations identify workflow capabilities; they do not authorize installation, writes, publication or any action outside the user and host scope.

Related skills

  • cocosair - routing and shared Code First constraints; reuse it if already loaded.
  • cocosair-application - createAirApp options and lifecycle that carry the physics field.
  • cocosair-scene-graph - component mount order and deferred destroy(), which colliders and the lazy world sync both depend on.
  • cocosair-verification - the browser-matrix contract rows behind the builtin boundary below.

Original entry guidance

The original entry wording below is an on-demand archive, not a second routing source.

Use the environment rules to locate the checkout or installed package; sibling skills are optional direct dependencies, not a recursive load list.

Pick the backend honestly, mount the framework components, and state what each backend actually simulates - no Creator asset bundle, no WASM artifacts, no parallel physics abstraction.

Read references/quick-start.md when constructing the minimal example. It preserves the complete setup and teardown sequence; select the source-checkout or npm-consumer environment first.

Read references/context.md to select the owner of this step and only its directly needed dependencies. Reuse already loaded skills; this is not a recursive load list.

Original mistake navigation

Before implementing the relevant path, read its wrong/right examples in references/common-mistakes.md:

  • [HIGH] Calling createAirApp({}) and expecting gravity or stacking
  • [HIGH] Setting only the collision group and losing every pair
  • [MEDIUM] Asking for a WASM backend that is not shipped
  • [MEDIUM] Reading 3D backend identity from the flat selector export

Original metadata

Description and description_en

The two original fields contained exactly the same value, retained once here.

Applies to physics in code-first Cocos AIR apps - choosing the 3D backend with createAirApp({ physics: 'builtin' | 'cannon' }) (default builtin), selectPhysicsBackend and the official last-registration-before-init rule, the query-only boundary of the builtin discrete collision detector (no gravity integration, no MeshCollider in the world, trigger events and raycasts still real), PhysicsSystem/RigidBody/Collider wiring and the bidirectional group-and-mask filter, error 9642 for default-physics-material (fatal on cannon, benign on builtin) and AIR's built-in material registration, and the pure-JS 2D box2d backend with PhysicsSystem2D, RigidBody2D, Collider2D, BoxCollider2D and the raycast/testPoint/testAABB queries. Use when dynamic bodies do not fall or stack, when triggers fire silently, when deciding between builtin and cannon, when 9642 appears in the console, or when asking whether ammo, physx or box2d-wasm ship (they do not).

Keywords

Cocos AIR, cocosair.js, physics

References

  • backend-selection.md - the selector registry and event ordering, default normalization, zero-backend warn versus PHYSICS_NONE, the 9642 split and the built-in material registration, and why WASM backends are absent.
  • 3d-contracts.md - PhysicsSystem singleton timing, mount and query API, filter semantics, the builtin query-only boundary item by item, and what cannon inverts.
  • 2d-box2d.md - PhysicsSystem2D, deterministic stepping, rigid-body and collider components, shape set, joints, and the raycast/testPoint/testAABB queries.

Canonical docs

  • docs/manual/physics-2d-and-3d.md - open for the backend comparison table, the four event families and the five runnable physics examples.
  • docs/notes/physics-3d-notes.md - open for the browser-measured builtin boundary, filter semantics, lazy sync and the cannon variant reversal.
  • docs/reference/api-stability.md - open for which physics APIs are Stable versus Candidate and why (docs/reference/api-stability.md:40-52).

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at ed38648. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated last month
layer
subsystem
All 1 allowed tools
Read Edit Write Bash
Other metadata
compatibility
Cocos AIR source checkout or installed cocosair.js package. Browser rendering requires WebGL 2; source tooling requires Node.js >=18. Use the host-provided tools and user-authorized workspace.
when_to_use
[
  "dynamic bodies do not fall or stack",
  "triggers stop firing after changing collision groups",
  "choose builtin or cannon before startup",
  "query 2D bodies with raycasts or overlap tests",
  "physics material error 9642 appears"
]
owns
[
  "builtin-physics",
  "cannon",
  "box2d",
  "collision-filter",
  "rigid-body",
  "physics-queries"
]
not_for
[
  "camera pixel-to-ray conversion -> cocosair-camera",
  "node hierarchy and transforms -> cocosair-scene-graph",
  "non-physics startup errors -> cocosair-application"
]
metadata
{
  "author": "oahc09@gmail.com",
  "version": "1.0.0",
  "last-updated": "2026-10-13",
  "description_zh": "选择 builtin 或 cannon,并区分碰撞检测、运动积分和二维 Box2D 的能力。用于刚体、触发器、射线查询或物理后端问题。"
}

README badge

README badge for oahc09/cocosairjs/cocosair-physics