Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

refactor(physics): the flat world stops owning the unsuffixed names

yhh6551b37a381b
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b80027f52..2c795bff6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,43 @@ Version numbers here track the **Estella release** — the engine + editor + SDK
shipped together, matching the Git tags and GitHub Releases. The SDK is not
published separately; it ships inside the editor.
+## [Unreleased]
+
+### Changed
+
+- **The flat physics components take the `2D` suffix the solid ones already had.**
+ Every component of the flat physics subsystem: the body (`RigidBody2D`), the
+ six collider shapes (box, circle, capsule, segment, polygon, chain), the mover
+ (`CharacterController2D`), `OneWayPlatform2D`, and all six joints — of which
+ `DistanceJoint` differed from `DistanceJoint3D` by three characters and one
+ solver.
+
+ Physics is the one place in the engine where two worlds genuinely exist, and
+ the bare names belonged to the flat one: a `BoxCollider` dropped on a mesh was
+ a flat box in a scene that is not flat. Now neither set owns the unsuffixed
+ name, which is the opposite conclusion from `Light2D` → `Light` and reached
+ the same way — a name says which of the things it is, and only stays bare when
+ there is one.
+
+ `BodyType` did **not** take a suffix: a body is static, kinematic or dynamic in
+ either world, and both components read the same enum. It moves to a header of
+ its own, so `RigidBody3D.hpp` no longer includes the flat body's header to
+ reach it.
+
+ **Scenes and prefabs migrate themselves**, through the door `Light2D` used:
+ the loader upgrades the old names on the way in, and the scene format is
+ version 3. An engine older than the rename REFUSES a version-3 file rather
+ than dropping the bodies it does not recognise and loading a level whose floor
+ nothing collides with.
+
+ **Breaking for code.** A script importing any of these from `esengine` must
+ import the new name; the data interfaces follow their component
+ (`RigidBodyData` → `RigidBody2DData`). The
+ SDK's physics *surface* is unchanged in this release — `Physics`,
+ `PhysicsPlugin`, `PhysicsEvents` and `ColliderShape` still carry bare names
+ against `Physics3DPlugin` and `ColliderShape3D`, and squaring that is an API
+ rename with no data in it.
+
## [0.56.0] - 2026-08-23
### Changed
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a2c5b627f..5c578a359 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -178,8 +178,9 @@ endif()
list(APPEND ESENGINE_HEADERS
- src/esengine/ecs/components/RigidBody.hpp
- src/esengine/ecs/components/Collider.hpp
+ src/esengine/ecs/components/BodyType.hpp
+ src/esengine/ecs/components/RigidBody2D.hpp
+ src/esengine/ecs/components/Collider2D.hpp
src/esengine/ecs/components/RigidBody3D.hpp
)
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md
index c25c39a1e..c55971436 100644
--- a/docs/ARCHITECTURE.md
+++ b/docs/ARCHITECTURE.md
@@ -368,10 +368,12 @@ The correctness and foundation campaigns are **complete**. Landed:
colliders, joints, character controllers). `Light2D` / `Mesh2D` dropped the
plane from their names (they are the only light and the only mesh renderer);
`ShadowCaster2D` keeps it, because it shadows what has no mesh to rasterize.
- Physics is the one place where two worlds really do exist, and the unsuffixed
- names — `RigidBody`, `BoxCollider`, `CircleCollider`, `CapsuleCollider` — are
- still the **flat** ones. That reads backwards in a 3D-first engine and is
- slated to be suffixed; see `REARCHITECTURE.md`.
+ Physics is the one place where two worlds really do exist, so both are named
+ for their plane: `RigidBody2D` and the four `*Collider2D` shapes beside
+ `RigidBody3D` and its five, and neither set owns the bare name. `BodyType` is
+ shared — a body is static, kinematic or dynamic in either world — and lives in
+ a header of its own rather than in the flat one's, which is where the 3D
+ component used to reach for it.
Remaining capability work (see `REARCH_2D_PARITY.md`, gitignored):
- [ ] T2 — editor keyframe/curve editing UI; particle visual editor; native 2D
@@ -379,7 +381,10 @@ Remaining capability work (see `REARCH_2D_PARITY.md`, gitignored):
- [ ] T3 — GPU particles / trails (transform-feedback or compute).
- [ ] T4 — one-way platforms + remaining Box2D joints; editor multi-atlas painting;
tile-gid objects in tilemaps.
-- [ ] Flat-physics naming — the `2D` suffix decided above.
+- [ ] The SDK's flat physics surface still carries bare names the components no
+ longer do: `Physics`, `PhysicsPlugin`, `PhysicsEvents`, `ColliderShape`,
+ against `Physics3DPlugin` / `ColliderShape3D`. Nothing on disk is keyed by
+ those, so squaring it is an API rename with no migration in it.
- [ ] Two pixel gates still run on one backend: `camera-render-target` (a frame
holding both an offscreen and a surface pass returns nothing from the
WebGPU readback) and `device-loss`. The other 121 assert on both.
diff --git a/docs/REARCHITECTURE.md b/docs/REARCHITECTURE.md
index 8600049ee..d9c091829 100644
--- a/docs/REARCHITECTURE.md
+++ b/docs/REARCHITECTURE.md
@@ -233,13 +233,17 @@ CHANGELOG 和提交信息里,这里只写**从那里读不出来的结构性
loader 自升级,格式 v2;旧引擎**拒绝** v2 而不是把 `Light` 当没听说过的组件读成一关没有灯。
- **验证面**:123 个像素门禁中 121 个双后端断言;`tools/render-host/` 让 100 个门禁在**引擎自己的**
无头宿主上跑,而不是经编辑器——门禁断言的是出货游戏看到的渲染器。
-- **仍开着的一处**:物理是唯一真有两个世界的地方,而无后缀的名字(`RigidBody` / `BoxCollider` /
- `CircleCollider` / `CapsuleCollider`)现在归了**平面**那套,3D 那套反而带 `3D` 后缀。在一个默认
- 世界是三维的引擎里这是反的:用户给 mesh 挂 `BoxCollider` 拿到的是平面盒子,`CapsuleCollider`
- 与 `CapsuleCollider3D` 并排尤其危险。**已拍板:给平面那套加 `2D` 后缀**(`RigidBody2D` /
- `BoxCollider2D` / `CircleCollider2D` / `CapsuleCollider2D`),走 `Light`/`MeshRenderer` 同款做法——
- loader 升级旧名、场景格式版本再进一格、SDK 破坏性改名进 CHANGELOG。SDK 面同时收口:2D 有
- `Physics` facade 而 3D 是 `Physics3DQueries`,两者从同一个 `esengine` 面导出却不同形。
+- **最后一处命名割裂已收口(2026-08-23)**:物理是唯一真有两个世界的地方,而无后缀的名字曾经归了
+ **平面**那套——用户给 mesh 挂一个 `BoxCollider` 拿到的是平面盒子,`CapsuleCollider` 与
+ `CapsuleCollider3D` 并排尤其危险。现在两边都按平面命名:`RigidBody2D` + 四个 `*Collider2D` +
+ `CharacterController2D`,对面是 `RigidBody3D` + 五个 `*Collider3D` + `CharacterController3D`,
+ **裸名字不属于任何一边**。做法与 `Light`/`MeshRenderer` 同款:`RENAMED_COMPONENT_TYPES` 收旧名、
+ 场景格式进到 3、旧引擎拒绝 3 而不是加载一个没有碰撞体的关卡。
+ 顺带把 `BodyType` 提到自己的头文件——它两个世界共用,此前 `RigidBody3D.hpp` 要 include
+ `RigidBody.hpp` 才拿得到,"3D 依赖 2D 的头"本身就是这处倒置的一个症状。
+- **余下的是纯 API 面**:SDK 的平面物理仍是裸名(`Physics` / `PhysicsPlugin` / `PhysicsEvents` /
+ `ColliderShape`),对面是 `Physics3DPlugin` / `ColliderShape3D`。磁盘上没有任何东西以这些为键,
+ 所以收口它是一次纯粹的破坏性改名、零迁移——待拍板,单独一步做。
### RC6 资产管线 — 📋 已立项(设计文档)
见 [`REARCH_RC6_ASSETS.md`](./REARCH_RC6_ASSETS.md):面向微信/移动端的资产管线根治——GPU 压缩纹理(keystone)、内容寻址身份、显存预算 + LRU 驱逐、运行时分包/流式 + 微信分包映射。属"能力/平台错配"根治,区别于 RC1–RC5 的"正确性根因"。
@@ -253,4 +257,4 @@ CHANGELOG 和提交信息里,这里只写**从那里读不出来的结构性
- **N4 输入上行 + ownership**:客户端 seq 戳输入命令走控制面(乱序旧包永不覆盖新态);服务器按连接存最新、`inputOf(connectionId)` 暴露给 gameplay(FixedUpdate 里对 `Replicated.owner` 的实体应用输入 = 普通 ECS 代码);客户端 `ownsEntity()` 判"这个 ghost 是不是我的"。全环路测试:客户端输入 → 服务器积分 → ghost 落在权威结果上。验证累计 26 复制用例 + 全套 2949 绿。
- **N5 权威宿主**:同一 wasm + 同一 gameplay 代码跑无头 Node 游戏服务器。新 `esengine/node` 入口——node 平台适配器(文件系统优先的资产访问、socket 走全局 WebSocket(Node≥22)、静音 `NullAudioBackend`、无 DOM,渲染性能力 fail-loud)、`loadEsengineModule`(emscripten glue 原生跑 Node)、`createHeadlessApp`(全仿真栈:assets/prefabs/scenes/timers/AI/replication,零渲染/管线/输入/UI)+ `runHeadless` 墙钟循环;`lifecyclePlugin` 不再假定 DOM。服务器侧 ws 拍板:SDK 零运行时依赖——宿主自选接收端(`ws` 仅 devDependency 供 e2e),任意 socket 包成 `NetTransport` 即 `attachConnection`。验证:真网络栈 e2e(无头服务器+真 wasm 接受 `ws` 连接 → 注解 builtin Transform + 用户组件复制到 `GameSocket` 客户端 → 输入回传)+ 纯 Node 冒烟(dist 入口加载引擎 wasm 起权威服务器步进)。
- **编辑器多人联调(同日收口)**:Play 模式下拉新增玩家数(1–4)。多人 Play = 主 realm 作 listen server(权威+玩家1)+ N−1 客户端 realm(各自 "Game P#" dock 页签),由编辑器随 init 转移的 MessageChannel 端口接线(新 SDK `MessagePortTransport`——结构化克隆原生承载双 wire 面、端口在对端未接前排队故启动顺序自由;worker 场景同样可用)。realm 里跑的就是出货游戏走 socket 的同一套 NetSession/复制栈——单机零网络即可实测多人 gameplay。`PlayRealm` 单例改实例 + 会话管理器(`PlayRealm` 导出保持为主实例,inspect/profiler/subsystems/PIE 全部消费者零改动);play 协议 v2(net 角色 + init 转移端口);多人会话中的代码 reload 整会话重启(端口已被活 NetSession 消费,单人热重载不变)。
-- **余项**:headless 资产模式(服务器加载含纹理场景需"跳过纹理/音频驻留"通道,现为 fail-loud);ghost 物理/AI 让位门控语义(RigidBody ghost 是否强制 kinematic)待真实 demo 驱动;本端预测+和解、relevancy/兴趣管理、C++ 批量快照优化、带宽量化——全部需求驱动不抢跑。编辑器多人 UI 交互按惯例待用户实测(tsc+双套件验证)。
+- **余项**:headless 资产模式(服务器加载含纹理场景需"跳过纹理/音频驻留"通道,现为 fail-loud);ghost 物理/AI 让位门控语义(RigidBody2D ghost 是否强制 kinematic)待真实 demo 驱动;本端预测+和解、relevancy/兴趣管理、C++ 批量快照优化、带宽量化——全部需求驱动不抢跑。编辑器多人 UI 交互按惯例待用户实测(tsc+双套件验证)。
diff --git a/docs/astro/src/content/docs/core-concepts/transforms.mdx b/docs/astro/src/content/docs/core-concepts/transforms.mdx
index ff2d478ab..a9984f120 100644
--- a/docs/astro/src/content/docs/core-concepts/transforms.mdx
+++ b/docs/astro/src/content/docs/core-concepts/transforms.mdx
@@ -116,7 +116,7 @@ colliders. It is *not* a sprite display scale. The split to remember:
| Collider dimensions (`halfExtents`, `radius`, …) | **meters** (divide px by PPU) |
| Solver-facing methods — forces, impulses, velocities, `setGravity` | **meters** |
| Spatial queries — `raycast`, `shapeCast*`, `overlapCircle`, `overlapAABB` | **world pixels** (auto-scaled) |
-| `CharacterController.velocity` / `moveCharacter` | **world pixels**/second |
+| `CharacterController2D.velocity` / `moveCharacter` | **world pixels**/second |
The defaults are exported as constants, so code that needs them never hard-codes
the numbers:
diff --git a/docs/astro/src/content/docs/gameplay/markers.mdx b/docs/astro/src/content/docs/gameplay/markers.mdx
index 447dcd0b9..e37432551 100644
--- a/docs/astro/src/content/docs/gameplay/markers.mdx
+++ b/docs/astro/src/content/docs/gameplay/markers.mdx
@@ -18,7 +18,7 @@ entities you select, edit in the Inspector, serialize with the scene, and read w
A Marker is just the `Marker` component (a `type` string and a free-form
`properties` map) on an entity that also has a `Transform`. On its own it's a
point — the game asks "where do I spawn the player?" by querying markers of a given
-`type`. Add a static [`RigidBody`](/docs/gameplay/physics/) and a sensor collider and
+`type`. Add a static [`RigidBody2D`](/docs/gameplay/physics/) and a sensor collider and
the same entity becomes a trigger zone; the **Trigger Area** preset wires all of
that up for you.
@@ -48,8 +48,8 @@ app.addPlugin(new PhysicsPlugin('physics.js'));
## Place one in the editor
**Create → Common → Marker** drops a named point at the scene origin; **Create →
-Physics → Trigger Area** drops a sensor region (Transform + static RigidBody + sensor
-BoxCollider + Marker). A Marker shows a **pin gizmo** in the viewport; a Trigger Area
+Physics → Trigger Area** drops a sensor region (Transform + static RigidBody2D + sensor
+BoxCollider2D + Marker). A Marker shows a **pin gizmo** in the viewport; a Trigger Area
also draws its collider outline, which you shape with the same
[collider gizmo](/docs/gameplay/physics/) as any other body.
@@ -100,7 +100,7 @@ const placePlayer = defineSystem([Commands(), Query(Marker, Transform)], (cmds,
## Trigger Areas
A **Trigger Area** is the Create preset for a sensor region: a `Transform`, a static
-`RigidBody` (`bodyType: 0`), a `BoxCollider` with `isSensor: true`, and a `Marker`.
+`RigidBody2D` (`bodyType: 0`), a `BoxCollider2D` with `isSensor: true`, and a `Marker`.
Because the collider is a sensor it detects overlaps **without** a physical response —
nothing bounces off a trigger; it just reports who entered.
diff --git a/docs/astro/src/content/docs/gameplay/physics.mdx b/docs/astro/src/content/docs/gameplay/physics.mdx
index 0a077c7af..d1f0a6fc3 100644
--- a/docs/astro/src/content/docs/gameplay/physics.mdx
+++ b/docs/astro/src/content/docs/gameplay/physics.mdx
@@ -6,7 +6,7 @@ description: The complete 2D physics reference — rigid bodies, colliders, coll
import { Aside } from '@astrojs/starlight/components';
Estella's physics runs in the C++/WebAssembly core, powered by Box2D v3. You attach
-a `RigidBody` and a collider to an entity, then move it with forces, query the world
+a `RigidBody2D` and a collider to an entity, then move it with forces, query the world
with raycasts, react to collisions, and connect bodies with joints. Physics steps at
a **fixed timestep**, decoupled from the frame rate, for stable simulation.
@@ -24,7 +24,7 @@ app.addPlugin(new PhysicsPlugin('physics.js', { gravity: { x: 0, y: -9.81 } }));
<Aside type="note">
Physics types are imported from **`esengine/physics`** (the API, plugin, events),
- while the components (`RigidBody`, colliders, `CharacterController`) come from the
+ while the components (`RigidBody2D`, colliders, `CharacterController2D`) come from the
main `esengine` barrel.
</Aside>
@@ -40,7 +40,7 @@ side of that boundary:
| Collider component dimensions — `halfExtents`, `radius`, `offset`, … | **Meters.** |
| Solver-facing methods — `applyForce` / `applyImpulse`, `setLinearVelocity` / `getLinearVelocity`, `setGravity`, … | **Meters** (m/s, m/s²). |
| Spatial queries — `raycast`, `shapeCast*`, `overlapCircle` / `overlapAABB`, `moveCharacter` | **World pixels**, scaled by the live PPU. |
-| `CharacterController.velocity`, `MotorJoint.linearVelocity` | World pixels per second. |
+| `CharacterController2D.velocity`, `MotorJoint2D.linearVelocity` | World pixels per second. |
`physics.getPixelsPerUnit()` returns the live PPU (pushed from the `Canvas` each
frame), so conversions never hard-code `100`:
@@ -61,14 +61,14 @@ queries and the character controller = pixels.**
*Collider gizmos in the viewport: the selected **Ground**'s box outline (amber) plus the walls and ramp. Toggle them with the viewport's Physics show-flag.*
-Attach a `RigidBody` plus one collider shape. **Collider dimensions are in meters,
+Attach a `RigidBody2D` plus one collider shape. **Collider dimensions are in meters,
not pixels** — divide pixel sizes by your pixels-per-unit (see [Units](#units)).
Spawn from a system that takes `Commands()`:
```typescript
import {
defineSystem, Commands, Transform,
- RigidBody, BodyType, CircleCollider,
+ RigidBody2D, BodyType, CircleCollider2D,
} from 'esengine';
const PPU = 100; // = Canvas.pixelsPerUnit; read the live value via physics.getPixelsPerUnit()
@@ -76,12 +76,12 @@ const PPU = 100; // = Canvas.pixelsPerUnit; read the live value via physics.ge
const spawnBall = defineSystem([Commands()], (cmds) => {
cmds.spawn()
.insert(Transform, { position: { x: 0, y: 250, z: 0 } })
- .insert(RigidBody, { bodyType: BodyType.Dynamic, gravityScale: 1 })
- .insert(CircleCollider, { radius: 24 / PPU, density: 1, friction: 0.3, restitution: 0.4 });
+ .insert(RigidBody2D, { bodyType: BodyType.Dynamic, gravityScale: 1 })
+ .insert(CircleCollider2D, { radius: 24 / PPU, density: 1, friction: 0.3, restitution: 0.4 });
});
```
-### `RigidBody`
+### `RigidBody2D`
| Property | Type | Default | Description |
|---|---|---|---|
@@ -111,12 +111,12 @@ are in meters.
| Component | Shape parameters |
|---|---|
-| `BoxCollider` | `halfExtents` (`{0.5, 0.5}`), `radius` (rounded corner, `0.05`). |
-| `CircleCollider` | `radius` (`0.5`). |
-| `CapsuleCollider` | `radius`, `halfHeight`. |
-| `SegmentCollider` | `point1`, `point2` (a one-sided edge). |
-| `PolygonCollider` | `vertices: Vec2[]`, `radius` (rounded). |
-| `ChainCollider` | `points: Vec2[]`, `isLoop` (static edge chain; no `density`/`isSensor`). |
+| `BoxCollider2D` | `halfExtents` (`{0.5, 0.5}`), `radius` (rounded corner, `0.05`). |
+| `CircleCollider2D` | `radius` (`0.5`). |
+| `CapsuleCollider2D` | `radius`, `halfHeight`. |
+| `SegmentCollider2D` | `point1`, `point2` (a one-sided edge). |
+| `PolygonCollider2D` | `vertices: Vec2[]`, `radius` (rounded). |
+| `ChainCollider2D` | `points: Vec2[]`, `isLoop` (static edge chain; no `density`/`isSensor`). |
## Collision filtering
@@ -132,7 +132,7 @@ const LAYER_PLAYER = 0x0001;
const LAYER_ENEMY = 0x0002;
const LAYER_GROUND = 0x0008;
-.insert(CircleCollider, {
+.insert(CircleCollider2D, {
radius: 16 / PPU,
categoryBits: LAYER_PLAYER,
maskBits: LAYER_ENEMY | LAYER_GROUND, // ignores other players
@@ -153,10 +153,10 @@ methods talk to the solver directly, so they are all in **meters** (m/s, m/s²
see [Units](#units)). Every method takes the world entity:
```typescript
-import { defineSystem, Query, Res, RigidBody } from 'esengine';
+import { defineSystem, Query, Res, RigidBody2D } from 'esengine';
import { Physics } from 'esengine/physics';
-const move = defineSystem([Query(RigidBody), Res(Physics)], (q, physics) => {
+const move = defineSystem([Query(RigidBody2D), Res(Physics)], (q, physics) => {
for (const [entity] of q) {
physics.applyForce(entity, { x: 0, y: 20 }); // continuous force
physics.applyImpulse(entity, { x: 0, y: 5 }); // instant kick (jump)
@@ -246,8 +246,8 @@ const onHit = defineSystem([Res(PhysicsEvents)], (events) => {
*What each joint constrains: a **Revolute** hinge (rotate about a pin), a **Distance** spring/rod, a **Prismatic** slider (one axis), a rigid **Weld**, a **Wheel** (suspension + free spin), and a **Motor** (driven toward a target velocity).*
-Connect two bodies. Add a joint **component** (`RevoluteJoint`, `DistanceJoint`,
-`PrismaticJoint`, `WeldJoint`, `WheelJoint`, `MotorJoint`), or create one imperatively
+Connect two bodies. Add a joint **component** (`RevoluteJoint2D`, `DistanceJoint2D`,
+`PrismaticJoint2D`, `WeldJoint2D`, `WheelJoint2D`, `MotorJoint2D`), or create one imperatively
and drive its motor / limits:
```typescript
@@ -281,7 +281,7 @@ its own power:
```typescript
// A conveyor: drive the crate toward +x at a fixed speed.
-world.insert(crate, MotorJoint, {
+world.insert(crate, MotorJoint2D, {
connectedEntity: anchor,
linearVelocity: { x: 200, y: 0 }, // world px/s
maxVelocityForce: 500, // newtons available to reach it
@@ -300,19 +300,19 @@ the **Physics** entry in the viewport's Show Flags.
## One-way platforms
-Add `OneWayPlatform` to a static (or kinematic) collider to make it **one-sided** — a
+Add `OneWayPlatform2D` to a static (or kinematic) collider to make it **one-sided** — a
body lands on it from one direction and passes through from the others. This is the
classic jump-up-through-a-ledge behaviour, built on Box2D's pre-solve callback (zero
cost when no one-way platforms exist):
```typescript
-import { OneWayPlatform } from 'esengine/physics';
+import { OneWayPlatform2D } from 'esengine/physics';
const platform = world.spawn('ledge');
world.insert(platform, Transform, { position: { x: 0, y: 0 } });
-world.insert(platform, RigidBody, { bodyType: BodyType.Static });
-world.insert(platform, BoxCollider, { halfExtents: { x: 2, y: 0.2 } });
-world.insert(platform, OneWayPlatform, { normal: { x: 0, y: 1 } }); // solid top: land from above, pass from below
+world.insert(platform, RigidBody2D, { bodyType: BodyType.Static });
+world.insert(platform, BoxCollider2D, { halfExtents: { x: 2, y: 0.2 } });
+world.insert(platform, OneWayPlatform2D, { normal: { x: 0, y: 1 } }); // solid top: land from above, pass from below
```
`normal` is the solid-side direction in world space; `{ x: 0, y: 1 }` (the default)
@@ -344,7 +344,7 @@ spring's stiffness and grip.
## Character controller
For a player that walks along surfaces instead of tumbling like a dynamic body, add
-a `CharacterController`. Set its `velocity` from gameplay each step; the controller
+a `CharacterController2D`. Set its `velocity` from gameplay each step; the controller
advances it one step with Box2D's **native kinematic mover** (`b2World_CollideMover`
+ `b2SolvePlanes`) — it collides the body into contact *planes* and solves a
depenetrating slide, so a character resting on the ground slides and jumps cleanly
@@ -352,9 +352,9 @@ instead of sticking to it. It writes the resolved pose back and reports what it
touched:
```typescript
-import { defineSystem, Query, Mut, CharacterController } from 'esengine';
+import { defineSystem, Query, Mut, CharacterController2D } from 'esengine';
-const drive = defineSystem([Query(Mut(CharacterController))], (q) => {
+const drive = defineSystem([Query(Mut(CharacterController2D))], (q) => {
for (const [entity, cc] of q) {
cc.velocity = { x: input.moveX * 240, y: cc.velocity.y - 900 * dt }; // gravity
if (cc.isOnFloor && jumpPressed) cc.velocity.y = 480;
@@ -364,7 +364,7 @@ const drive = defineSystem([Query(Mut(CharacterController))], (q) => {
Give the entity a collider (the mover shape is derived from it — a box becomes a
capsule inscribed along its longer axis) and, if other bodies should collide with
-the character, a **Kinematic** `RigidBody`. The mover excludes the character's own
+the character, a **Kinematic** `RigidBody2D`. The mover excludes the character's own
body automatically, so its `maskBits` need not avoid its own collision layer. Drive
`velocity` from a fixed-timestep system so motion is frame-rate independent; read the
`isOnFloor` edge for jumps (delivered correctly to `FixedUpdate` — see
diff --git a/docs/astro/src/content/docs/getting-started/quick-start.mdx b/docs/astro/src/content/docs/getting-started/quick-start.mdx
index 48ebe0717..c73cac7f3 100644
--- a/docs/astro/src/content/docs/getting-started/quick-start.mdx
+++ b/docs/astro/src/content/docs/getting-started/quick-start.mdx
@@ -70,7 +70,7 @@ shape draws without needing a texture.
<Aside type="caution">
The copy in step 3 is not ceremony. `ctx.get` hands back the stored object for
- a component you declared yourself, but `Transform`, `Sprite`, `RigidBody` and
+ a component you declared yourself, but `Transform`, `Sprite`, `RigidBody2D` and
every other engine component are decoded out of the wasm heap on each read —
so `ctx.get(Transform).position.x += …` changes a value nobody keeps, and does
it silently. Read it, change it, hand it back with `ctx.set`. See
diff --git a/docs/astro/src/content/docs/scripting/input.mdx b/docs/astro/src/content/docs/scripting/input.mdx
index c026b4122..a2db169f9 100644
--- a/docs/astro/src/content/docs/scripting/input.mdx
+++ b/docs/astro/src/content/docs/scripting/input.mdx
@@ -68,7 +68,7 @@ buffering on your side.
```typescript
// Schedule.FixedPreUpdate — the edge is delivered reliably.
-const jump = defineSystem([Query(Mut(CharacterController)), Res(Input)], (players, input) => {
+const jump = defineSystem([Query(Mut(CharacterController2D)), Res(Input)], (players, input) => {
for (const [, cc] of players) {
if (cc.isOnFloor && input.isKeyPressed('Space')) cc.velocity.y = JUMP_FORCE;
}
diff --git a/docs/astro/src/content/docs/scripting/overview.mdx b/docs/astro/src/content/docs/scripting/overview.mdx
index 08b0e9e1c..df6ab7b02 100644
--- a/docs/astro/src/content/docs/scripting/overview.mdx
+++ b/docs/astro/src/content/docs/scripting/overview.mdx
@@ -38,7 +38,7 @@ export const Patrol = defineBehavior('Patrol', {
<Aside type="caution">
**Engine components come back as a copy.** `ctx.get` hands you the stored object
for a *script* component — your own `defineComponent`, and `ctx.self` — so mutating
- it sticks. `Transform`, `Sprite`, `RigidBody` and every other C++-backed component
+ it sticks. `Transform`, `Sprite`, `RigidBody2D` and every other C++-backed component
are decoded out of the wasm heap on each read, so `ctx.get(Transform).position.x += …`
changes a value nobody keeps, silently. Read it, change it, hand it back with
`ctx.set`.
@@ -343,7 +343,7 @@ world.spawn()
});
```
-Entities with a `RigidBody` are skipped — the physics solver owns their transform,
+Entities with a `RigidBody2D` are skipped — the physics solver owns their transform,
so the two never fight over one entity. `Velocity` is also replication-aware: its
fields are replicated, so networked clients can dead-reckon between snapshots.
diff --git a/docs/astro/src/content/docs/zh-cn/core-concepts/transforms.mdx b/docs/astro/src/content/docs/zh-cn/core-concepts/transforms.mdx
index 397b45b64..698c4192f 100644
--- a/docs/astro/src/content/docs/zh-cn/core-concepts/transforms.mdx
+++ b/docs/astro/src/content/docs/zh-cn/core-concepts/transforms.mdx
@@ -103,7 +103,7 @@ world / design px ── ÷ Canvas.pixelsPerUnit (100) ──▶ physics mete
| 碰撞体尺寸(`halfExtents`、`radius` 等) | **米**(像素 ÷ PPU) |
| 面向求解器的方法——力、冲量、速度、`setGravity` | **米** |
| 空间查询——`raycast`、`shapeCast*`、`overlapCircle`、`overlapAABB` | **世界像素**(自动换算) |
-| `CharacterController.velocity` / `moveCharacter` | **世界像素**/秒 |
+| `CharacterController2D.velocity` / `moveCharacter` | **世界像素**/秒 |
这些默认值以常量导出,需要它们的代码不必硬编码数字:
diff --git a/docs/astro/src/content/docs/zh-cn/gameplay/markers.mdx b/docs/astro/src/content/docs/zh-cn/gameplay/markers.mdx
index 868b4181a..dc31cd1a8 100644
--- a/docs/astro/src/content/docs/zh-cn/gameplay/markers.mdx
+++ b/docs/astro/src/content/docs/zh-cn/gameplay/markers.mdx
@@ -15,7 +15,7 @@ import { Aside } from '@astrojs/starlight/components';
Marker 就是 `Marker` 组件(一个 `type` 字符串加一个自由形式的 `properties` 映射),挂在一个
同时带 `Transform` 的实体上。单独存在时它是一个点——游戏通过查询某个 `type` 的标记来问“该在
-哪里生成玩家?”。给同一个实体加上一个静态 [`RigidBody`](/docs/zh-cn/gameplay/physics/) 和一个
+哪里生成玩家?”。给同一个实体加上一个静态 [`RigidBody2D`](/docs/zh-cn/gameplay/physics/) 和一个
传感器碰撞体,它就变成一块触发区;**Trigger Area** 预设会替你把这些一次接好。
因为 Marker 是纯 ECS,没有任何特殊的东西要加载或解析:
@@ -43,7 +43,7 @@ app.addPlugin(new PhysicsPlugin('physics.js'));
## 在编辑器里放置
**Create → Common → Marker** 在场景原点放一个命名点;**Create → Physics → Trigger Area**
-放一块传感区域(Transform + 静态 RigidBody + 传感器 BoxCollider + Marker)。Marker 在视口里显示
+放一块传感区域(Transform + 静态 RigidBody2D + 传感器 BoxCollider2D + Marker)。Marker 在视口里显示
一个**图钉 gizmo**;Trigger Area 还会画出它的碰撞体轮廓,你用与任何其他刚体相同的
[碰撞体 gizmo](/docs/zh-cn/gameplay/physics/) 来塑形。
@@ -90,8 +90,8 @@ const placePlayer = defineSystem([Commands(), Query(Marker, Transform)], (cmds,
## 触发区(Trigger Areas)
-**Trigger Area** 是传感区域的 Create 预设:一个 `Transform`、一个静态 `RigidBody`
-(`bodyType: 0`)、一个 `isSensor: true` 的 `BoxCollider`,加一个 `Marker`。因为碰撞体是传感器,
+**Trigger Area** 是传感区域的 Create 预设:一个 `Transform`、一个静态 `RigidBody2D`
+(`bodyType: 0`)、一个 `isSensor: true` 的 `BoxCollider2D`,加一个 `Marker`。因为碰撞体是传感器,
它检测重叠但**不产生**物理响应——没有东西会从触发区弹开;它只报告谁进来了。
从 `PhysicsEvents` 资源读取进入与离开。每个传感事件都给出 `sensorEntity`(触发区)和
diff --git a/docs/astro/src/content/docs/zh-cn/gameplay/physics.mdx b/docs/astro/src/content/docs/zh-cn/gameplay/physics.mdx
index 6be9bbbcd..a3be1620e 100644
--- a/docs/astro/src/content/docs/zh-cn/gameplay/physics.mdx
+++ b/docs/astro/src/content/docs/zh-cn/gameplay/physics.mdx
@@ -5,7 +5,7 @@ description: 完整的 2D 物理参考——刚体、碰撞体、碰撞过滤、
import { Aside } from '@astrojs/starlight/components';
-Estella 的物理跑在 C++/WebAssembly 内核里,由 Box2D v3 驱动。你给实体加一个 `RigidBody`
+Estella 的物理跑在 C++/WebAssembly 内核里,由 Box2D v3 驱动。你给实体加一个 `RigidBody2D`
和一个碰撞体,然后用力移动它、用射线查询世界、响应碰撞、用关节连接刚体。物理以**固定时间步**
推进,与帧率解耦,得到稳定的模拟。
@@ -21,8 +21,8 @@ app.addPlugin(new PhysicsPlugin('physics.js', { gravity: { x: 0, y: -9.81 } }));
```
<Aside type="note">
- 物理的类型从 **`esengine/physics`** 导入(API、插件、事件),而组件(`RigidBody`、各碰撞体、
- `CharacterController`)来自主 `esengine` barrel。
+ 物理的类型从 **`esengine/physics`** 导入(API、插件、事件),而组件(`RigidBody2D`、各碰撞体、
+ `CharacterController2D`)来自主 `esengine` barrel。
</Aside>
## 单位
@@ -36,7 +36,7 @@ Box2D 以**米**模拟;引擎其余部分以**世界像素**工作。二者的
| 碰撞体组件尺寸——`halfExtents`、`radius`、`offset`…… | **米。** |
| 面向求解器的方法——`applyForce` / `applyImpulse`、`setLinearVelocity` / `getLinearVelocity`、`setGravity`…… | **米**(m/s、m/s²)。 |
| 空间查询——`raycast`、`shapeCast*`、`overlapCircle` / `overlapAABB`、`moveCharacter` | **世界像素**,按当前 PPU 缩放。 |
-| `CharacterController.velocity`、`MotorJoint.linearVelocity` | 世界像素/秒。 |
+| `CharacterController2D.velocity`、`MotorJoint2D.linearVelocity` | 世界像素/秒。 |
`physics.getPixelsPerUnit()` 返回当前 PPU(每帧从 `Canvas` 推送),换算永远不用写死 `100`:
@@ -55,13 +55,13 @@ physics.applyImpulse(e, { x: 0, y: jumpPx / ppu }); // px/s → m/s
*视口里的碰撞体 gizmo:选中的 **Ground** 的盒形轮廓(琥珀色),以及墙体与斜坡。用视口的物理显示开关切换。*
-加一个 `RigidBody` 再加一个碰撞体形状。**碰撞体尺寸以米计,不是像素**——把像素尺寸除以你的
+加一个 `RigidBody2D` 再加一个碰撞体形状。**碰撞体尺寸以米计,不是像素**——把像素尺寸除以你的
每单位像素数(见[单位](#单位))。从一个取 `Commands()` 的系统里生成:
```typescript
import {
defineSystem, Commands, Transform,
- RigidBody, BodyType, CircleCollider,
+ RigidBody2D, BodyType, CircleCollider2D,
} from 'esengine';
const PPU = 100; // = Canvas.pixelsPerUnit; read the live value via physics.getPixelsPerUnit()
@@ -69,12 +69,12 @@ const PPU = 100; // = Canvas.pixelsPerUnit; read the live value via physics.ge
const spawnBall = defineSystem([Commands()], (cmds) => {
cmds.spawn()
.insert(Transform, { position: { x: 0, y: 250, z: 0 } })
- .insert(RigidBody, { bodyType: BodyType.Dynamic, gravityScale: 1 })
- .insert(CircleCollider, { radius: 24 / PPU, density: 1, friction: 0.3, restitution: 0.4 });
+ .insert(RigidBody2D, { bodyType: BodyType.Dynamic, gravityScale: 1 })
+ .insert(CircleCollider2D, { radius: 24 / PPU, density: 1, friction: 0.3, restitution: 0.4 });
});
```
-### `RigidBody`
+### `RigidBody2D`
| 属性 | 类型 | 默认 | 说明 |
|---|---|---|---|
@@ -103,12 +103,12 @@ const spawnBall = defineSystem([Commands()], (cmds) => {
| 组件 | 形状参数 |
|---|---|
-| `BoxCollider` | `halfExtents`(`{0.5, 0.5}`)、`radius`(圆角,`0.05`)。 |
-| `CircleCollider` | `radius`(`0.5`)。 |
-| `CapsuleCollider` | `radius`、`halfHeight`。 |
-| `SegmentCollider` | `point1`、`point2`(单边)。 |
-| `PolygonCollider` | `vertices: Vec2[]`、`radius`(圆角)。 |
-| `ChainCollider` | `points: Vec2[]`、`isLoop`(静态边链;无 `density`/`isSensor`)。 |
+| `BoxCollider2D` | `halfExtents`(`{0.5, 0.5}`)、`radius`(圆角,`0.05`)。 |
+| `CircleCollider2D` | `radius`(`0.5`)。 |
+| `CapsuleCollider2D` | `radius`、`halfHeight`。 |
+| `SegmentCollider2D` | `point1`、`point2`(单边)。 |
+| `PolygonCollider2D` | `vertices: Vec2[]`、`radius`(圆角)。 |
+| `ChainCollider2D` | `points: Vec2[]`、`isLoop`(静态边链;无 `density`/`isSensor`)。 |
## 碰撞过滤
@@ -124,7 +124,7 @@ const LAYER_PLAYER = 0x0001;
const LAYER_ENEMY = 0x0002;
const LAYER_GROUND = 0x0008;
-.insert(CircleCollider, {
+.insert(CircleCollider2D, {
radius: 16 / PPU,
categoryBits: LAYER_PLAYER,
maskBits: LAYER_ENEMY | LAYER_GROUND, // ignores other players
@@ -142,10 +142,10 @@ const LAYER_GROUND = 0x0008;
所以全部以**米**计(m/s、m/s²——见[单位](#单位))。每个方法都取世界实体:
```typescript
-import { defineSystem, Query, Res, RigidBody } from 'esengine';
+import { defineSystem, Query, Res, RigidBody2D } from 'esengine';
import { Physics } from 'esengine/physics';
-const move = defineSystem([Query(RigidBody), Res(Physics)], (q, physics) => {
+const move = defineSystem([Query(RigidBody2D), Res(Physics)], (q, physics) => {
for (const [entity] of q) {
physics.applyForce(entity, { x: 0, y: 20 }); // continuous force
physics.applyImpulse(entity, { x: 0, y: 5 }); // instant kick (jump)
@@ -234,8 +234,8 @@ const onHit = defineSystem([Res(PhysicsEvents)], (events) => {
*每种关节约束什么:**Revolute** 铰链(绕销钉转动)、**Distance** 弹簧/连杆、**Prismatic** 滑轨(单轴滑动)、刚性 **Weld** 焊接、**Wheel** 车轮(悬挂 + 自由旋转),以及 **Motor** 马达(驱向目标速度)。*
-连接两个刚体。加一个关节**组件**(`RevoluteJoint`、`DistanceJoint`、`PrismaticJoint`、
-`WeldJoint`、`WheelJoint`、`MotorJoint`),或命令式创建一个并驱动它的马达 / 限位:
+连接两个刚体。加一个关节**组件**(`RevoluteJoint2D`、`DistanceJoint2D`、`PrismaticJoint2D`、
+`WeldJoint2D`、`WheelJoint2D`、`MotorJoint2D`),或命令式创建一个并驱动它的马达 / 限位:
```typescript
// A hinge with a motor (a powered wheel or swinging door).
@@ -267,7 +267,7 @@ physics.destroyJoint(bodyA);
```typescript
// 传送带:把箱子沿 +x 匀速驱动。
-world.insert(crate, MotorJoint, {
+world.insert(crate, MotorJoint2D, {
connectedEntity: anchor,
linearVelocity: { x: 200, y: 0 }, // 世界像素/秒
maxVelocityForce: 500, // 可用于达到该速度的力(牛顿)
@@ -284,18 +284,18 @@ physics.setMotorJointLinearVelocity(crate, { x: -200, y: 0 }); // 运行时反
## 单向平台
-给静态(或运动学)碰撞体加 `OneWayPlatform`,使其**单面**——刚体从一个方向落上去、从其它
+给静态(或运动学)碰撞体加 `OneWayPlatform2D`,使其**单面**——刚体从一个方向落上去、从其它
方向穿过。这就是经典的"从下往上跳穿平台"行为,建在 Box2D 的 pre-solve 回调上(没有单向平台时
零开销):
```typescript
-import { OneWayPlatform } from 'esengine/physics';
+import { OneWayPlatform2D } from 'esengine/physics';
world.spawn(
Transform, { position: { x: 0, y: 0 } },
- RigidBody, { bodyType: BodyType.Static },
- BoxCollider, { halfExtents: { x: 2, y: 0.2 } },
- OneWayPlatform, { normal: { x: 0, y: 1 } }, // 实心顶面:从上落下、从下穿过
+ RigidBody2D, { bodyType: BodyType.Static },
+ BoxCollider2D, { halfExtents: { x: 2, y: 0.2 } },
+ OneWayPlatform2D, { normal: { x: 0, y: 1 } }, // 实心顶面:从上落下、从下穿过
);
```
@@ -323,15 +323,15 @@ physics.destroyMouseJoint();
## 角色控制器
-想让玩家沿着表面行走、而不是像动态刚体那样翻滚,加一个 `CharacterController`。每步从玩法设它
+想让玩家沿着表面行走、而不是像动态刚体那样翻滚,加一个 `CharacterController2D`。每步从玩法设它
的 `velocity`;控制器用 Box2D 的**原生运动学 mover**(`b2World_CollideMover` +
`b2SolvePlanes`)推进一步——把身体碰撞成接触*平面*,再解出一次去穿插的滑动,所以贴地的角色能
干净地移动和起跳,而不是粘在地面上。它把结果写回,并报告碰到了什么:
```typescript
-import { defineSystem, Query, Mut, CharacterController } from 'esengine';
+import { defineSystem, Query, Mut, CharacterController2D } from 'esengine';
-const drive = defineSystem([Query(Mut(CharacterController))], (q) => {
+const drive = defineSystem([Query(Mut(CharacterController2D))], (q) => {
for (const [entity, cc] of q) {
cc.velocity = { x: input.moveX * 240, y: cc.velocity.y - 900 * dt }; // gravity
if (cc.isOnFloor && jumpPressed) cc.velocity.y = 480;
@@ -340,7 +340,7 @@ const drive = defineSystem([Query(Mut(CharacterController))], (q) => {
```
给实体加一个碰撞体(mover 形状由它推导——盒子会内接成沿长轴的胶囊);若希望别的刚体能撞到角色,
-再加一个**运动学(Kinematic)** `RigidBody`。mover 会自动排除角色自身的刚体,所以它的 `maskBits`
+再加一个**运动学(Kinematic)** `RigidBody2D`。mover 会自动排除角色自身的刚体,所以它的 `maskBits`
不必刻意避开自身的碰撞层。用固定步长的系统驱动 `velocity` 让运动与帧率无关;跳跃读 `isOnFloor`
边沿(会正确投递到 `FixedUpdate`——见 [输入](/docs/zh-cn/scripting/input/#固定步长物理))。
diff --git a/docs/astro/src/content/docs/zh-cn/getting-started/quick-start.mdx b/docs/astro/src/content/docs/zh-cn/getting-started/quick-start.mdx
index cce26d62e..4e8fdedf8 100644
--- a/docs/astro/src/content/docs/zh-cn/getting-started/quick-start.mdx
+++ b/docs/astro/src/content/docs/zh-cn/getting-started/quick-start.mdx
@@ -59,7 +59,7 @@ import { Steps, Aside } from '@astrojs/starlight/components';
<Aside type="caution">
第 3 步里那份拷贝不是多余的仪式。对你自己声明的组件,`ctx.get` 给的是存储对象本身;但
- `Transform`、`Sprite`、`RigidBody` 这些引擎组件每次读都是从 wasm 堆里解出来的——所以
+ `Transform`、`Sprite`、`RigidBody2D` 这些引擎组件每次读都是从 wasm 堆里解出来的——所以
`ctx.get(Transform).position.x += …` 改的是一个没人保存的值,而且是**静默**的。读出来、
改完、用 `ctx.set` 交回去。参见[脚本](/docs/zh-cn/scripting/overview/#你的第一个-behavior)。
</Aside>
diff --git a/docs/astro/src/content/docs/zh-cn/scripting/input.mdx b/docs/astro/src/content/docs/zh-cn/scripting/input.mdx
index da7425645..9f815807d 100644
--- a/docs/astro/src/content/docs/zh-cn/scripting/input.mdx
+++ b/docs/astro/src/content/docs/zh-cn/scripting/input.mdx
@@ -64,7 +64,7 @@ const spawnAtCursor = defineSystem(
```typescript
// Schedule.FixedPreUpdate —— 边沿被可靠地投递。
-const jump = defineSystem([Query(Mut(CharacterController)), Res(Input)], (players, input) => {
+const jump = defineSystem([Query(Mut(CharacterController2D)), Res(Input)], (players, input) => {
for (const [, cc] of players) {
if (cc.isOnFloor && input.isKeyPressed('Space')) cc.velocity.y = JUMP_FORCE;
}
diff --git a/docs/astro/src/content/docs/zh-cn/scripting/overview.mdx b/docs/astro/src/content/docs/zh-cn/scripting/overview.mdx
index 4d4cb3311..e40e69e71 100644
--- a/docs/astro/src/content/docs/zh-cn/scripting/overview.mdx
+++ b/docs/astro/src/content/docs/zh-cn/scripting/overview.mdx
@@ -34,7 +34,7 @@ export const Patrol = defineBehavior('Patrol', {
<Aside type="caution">
**引擎组件拿到的是拷贝。** 对*脚本*组件——你自己 `defineComponent` 出来的,以及 `ctx.self`
- ——`ctx.get` 给的就是存储对象本身,改了就生效。而 `Transform`、`Sprite`、`RigidBody` 这些
+ ——`ctx.get` 给的就是存储对象本身,改了就生效。而 `Transform`、`Sprite`、`RigidBody2D` 这些
C++ 支撑的组件,每次读都是从 wasm 堆里解出来的一份拷贝,所以
`ctx.get(Transform).position.x += …` 改的是一个没人保存的值,而且**静默无效**。
读出来、改完、用 `ctx.set` 交回去。
@@ -310,7 +310,7 @@ world.spawn()
});
```
-带 `RigidBody` 的实体会被跳过——物理求解器拥有它们的变换,两者永远不会争抢同一个实体。
+带 `RigidBody2D` 的实体会被跳过——物理求解器拥有它们的变换,两者永远不会争抢同一个实体。
`Velocity` 也是复制感知的:它的字段参与网络复制,联网客户端可以在快照之间做航位推算。
## 它如何组合
diff --git a/docs/astro/src/data/apiStability.generated.json b/docs/astro/src/data/apiStability.generated.json
index a77a4e04f..be9af316c 100644
--- a/docs/astro/src/data/apiStability.generated.json
+++ b/docs/astro/src/data/apiStability.generated.json
@@ -165,7 +165,7 @@
"entry": [
"Physics",
"PhysicsEvents",
- "CharacterController"
+ "CharacterController2D"
]
},
{
@@ -1745,7 +1745,7 @@
]
},
{
- "name": "CharacterController",
+ "name": "CharacterController2D",
"kind": "const",
"deprecated": false,
"entries": [
diff --git a/docs/astro/src/data/componentDocs.ts b/docs/astro/src/data/componentDocs.ts
index 462fbb9b1..70ed5c105 100644
--- a/docs/astro/src/data/componentDocs.ts
+++ b/docs/astro/src/data/componentDocs.ts
@@ -100,13 +100,13 @@ export const COMPONENT_DOCS: Record<string, ComponentDoc> = {
UIToggle: { category: 'ui', summary: 'A two-state widget — checkbox or switch — and its group membership.', doc: 'ui/widgets', anchor: 'toggle', anchorZh: 'toggle-开关' },
// ── Physics ────────────────────────────────────────────────────────────────
- RigidBody: { category: 'physics', summary: 'Puts the entity under the solver: static, kinematic or dynamic, with damping, gravity scale and sleep.', doc: 'gameplay/physics', anchor: 'rigidbody', anchorZh: 'rigidbody' },
- BoxCollider: { category: 'physics', summary: 'A rectangular collision shape. Sizes are in **metres**, not pixels.', doc: 'gameplay/physics', anchor: 'colliders', anchorZh: '碰撞体' },
- CircleCollider: { category: 'physics', summary: 'A circular collision shape. Radius is in **metres**.', doc: 'gameplay/physics', anchor: 'colliders', anchorZh: '碰撞体' },
- CapsuleCollider: { category: 'physics', summary: 'A capsule collision shape — the usual choice for a character body.', doc: 'gameplay/physics', anchor: 'colliders', anchorZh: '碰撞体' },
- SegmentCollider: { category: 'physics', summary: 'A single line segment — a one-sided wall or edge.', doc: 'gameplay/physics', anchor: 'colliders', anchorZh: '碰撞体' },
- PolygonCollider: { category: 'physics', summary: 'A convex polygon collision shape from your own points.', doc: 'gameplay/physics', anchor: 'colliders', anchorZh: '碰撞体' },
- ChainCollider: { category: 'physics', summary: 'A polyline of edges — open or looped — for static terrain.', doc: 'gameplay/physics', anchor: 'colliders', anchorZh: '碰撞体' },
+ RigidBody2D: { category: 'physics', summary: 'Puts the entity under the flat solver: static, kinematic or dynamic, with damping, gravity scale and sleep.', doc: 'gameplay/physics', anchor: 'rigidbody2d', anchorZh: 'rigidbody2d' },
+ BoxCollider2D: { category: 'physics', summary: 'A rectangular collision shape. Sizes are in **metres**, not pixels.', doc: 'gameplay/physics', anchor: 'colliders', anchorZh: '碰撞体' },
+ CircleCollider2D: { category: 'physics', summary: 'A circular collision shape. Radius is in **metres**.', doc: 'gameplay/physics', anchor: 'colliders', anchorZh: '碰撞体' },
+ CapsuleCollider2D: { category: 'physics', summary: 'A capsule collision shape — the usual choice for a character body.', doc: 'gameplay/physics', anchor: 'colliders', anchorZh: '碰撞体' },
+ SegmentCollider2D: { category: 'physics', summary: 'A single line segment — a one-sided wall or edge.', doc: 'gameplay/physics', anchor: 'colliders', anchorZh: '碰撞体' },
+ PolygonCollider2D: { category: 'physics', summary: 'A convex polygon collision shape from your own points.', doc: 'gameplay/physics', anchor: 'colliders', anchorZh: '碰撞体' },
+ ChainCollider2D: { category: 'physics', summary: 'A polyline of edges — open or looped — for static terrain.', doc: 'gameplay/physics', anchor: 'colliders', anchorZh: '碰撞体' },
RigidBody3D: { category: 'physics', summary: 'Puts the entity under the 3D solver — its own component set, so a 2D scene keeps the world it already has.', doc: 'gameplay/physics-3d', anchor: 'bodies', anchorZh: '刚体' },
BoxCollider3D: { category: 'physics', summary: 'A box collision shape in 3D. Half-extents are in world units.', doc: 'gameplay/physics-3d', anchor: 'shapes', anchorZh: '形状' },
SphereCollider3D: { category: 'physics', summary: 'A sphere collision shape in 3D.', doc: 'gameplay/physics-3d', anchor: 'shapes', anchorZh: '形状' },
@@ -119,14 +119,14 @@ export const COMPONENT_DOCS: Record<string, ComponentDoc> = {
SliderJoint3D: { category: 'physics', summary: 'One axis of travel between two 3D bodies — a lift or a piston, with optional limits and a motor.', doc: 'gameplay/physics-3d', anchor: 'joints', anchorZh: '关节' },
DistanceJoint3D: { category: 'physics', summary: 'Keeps two 3D bodies a distance apart: a rope, a rod, or a spring when a frequency is given.', doc: 'gameplay/physics-3d', anchor: 'joints', anchorZh: '关节' },
FixedJoint3D: { category: 'physics', summary: 'Locks two 3D bodies together in the pose they were placed in — no freedom at all.', doc: 'gameplay/physics-3d', anchor: 'joints', anchorZh: '关节' },
- CharacterController: { category: 'physics', summary: 'Kinematic character movement that slides along walls, climbs slopes and reports ground contact.', doc: 'gameplay/physics', anchor: 'character-controller', anchorZh: '角色控制器' },
- OneWayPlatform: { category: 'physics', summary: 'Makes a collider solid from one side only, so a body passes up through it and lands on top.', doc: 'gameplay/physics', anchor: 'one-way-platforms', anchorZh: '单向平台' },
- DistanceJoint: { category: 'physics', summary: 'Holds two bodies a fixed (or spring-limited) distance apart.', doc: 'gameplay/physics', anchor: 'joints', anchorZh: '关节' },
- RevoluteJoint: { category: 'physics', summary: 'Pins two bodies at a point and lets them rotate — a hinge, with optional limits and a motor.', doc: 'gameplay/physics', anchor: 'joints', anchorZh: '关节' },
- PrismaticJoint: { category: 'physics', summary: 'Constrains two bodies to slide along one axis — a piston or lift.', doc: 'gameplay/physics', anchor: 'joints', anchorZh: '关节' },
- WeldJoint: { category: 'physics', summary: 'Locks two bodies rigidly together, with optional spring give.', doc: 'gameplay/physics', anchor: 'joints', anchorZh: '关节' },
- MotorJoint: { category: 'physics', summary: 'Drives one body toward a target offset and angle — moving platforms and conveyors.', doc: 'gameplay/physics', anchor: 'joints', anchorZh: '关节' },
- WheelJoint: { category: 'physics', summary: 'A suspension axis plus a spinning axle — the wheel half of a vehicle.', doc: 'gameplay/physics', anchor: 'joints', anchorZh: '关节' },
+ CharacterController2D: { category: 'physics', summary: 'Kinematic character movement that slides along walls, climbs slopes and reports ground contact.', doc: 'gameplay/physics', anchor: 'character-controller', anchorZh: '角色控制器' },
+ OneWayPlatform2D: { category: 'physics', summary: 'Makes a collider solid from one side only, so a body passes up through it and lands on top.', doc: 'gameplay/physics', anchor: 'one-way-platforms', anchorZh: '单向平台' },
+ DistanceJoint2D: { category: 'physics', summary: 'Holds two bodies a fixed (or spring-limited) distance apart.', doc: 'gameplay/physics', anchor: 'joints', anchorZh: '关节' },
+ RevoluteJoint2D: { category: 'physics', summary: 'Pins two bodies at a point and lets them rotate — a hinge, with optional limits and a motor.', doc: 'gameplay/physics', anchor: 'joints', anchorZh: '关节' },
+ PrismaticJoint2D: { category: 'physics', summary: 'Constrains two bodies to slide along one axis — a piston or lift.', doc: 'gameplay/physics', anchor: 'joints', anchorZh: '关节' },
+ WeldJoint2D: { category: 'physics', summary: 'Locks two bodies rigidly together, with optional spring give.', doc: 'gameplay/physics', anchor: 'joints', anchorZh: '关节' },
+ MotorJoint2D: { category: 'physics', summary: 'Drives one body toward a target offset and angle — moving platforms and conveyors.', doc: 'gameplay/physics', anchor: 'joints', anchorZh: '关节' },
+ WheelJoint2D: { category: 'physics', summary: 'A suspension axis plus a spinning axle — the wheel half of a vehicle.', doc: 'gameplay/physics', anchor: 'joints', anchorZh: '关节' },
// ── Animation ──────────────────────────────────────────────────────────────
Animator: { category: 'animation', summary: 'Runs an animator controller — states, transitions and blend trees — over the entity.', doc: 'animation/overview', anchor: 'animator-state-machine', anchorZh: '动画状态机' },
diff --git a/docs/astro/src/data/components.generated.json b/docs/astro/src/data/components.generated.json
index 6d7a07e88..ad9715bd5 100644
--- a/docs/astro/src/data/components.generated.json
+++ b/docs/astro/src/data/components.generated.json
@@ -199,7 +199,7 @@
]
},
{
- "name": "BoxCollider",
+ "name": "BoxCollider2D",
"source": "cpp",
"fields": [
{
@@ -504,7 +504,7 @@
]
},
{
- "name": "CapsuleCollider",
+ "name": "CapsuleCollider2D",
"source": "cpp",
"fields": [
{
@@ -602,7 +602,7 @@
]
},
{
- "name": "ChainCollider",
+ "name": "ChainCollider2D",
"source": "ts",
"fields": [
{
@@ -651,7 +651,7 @@
]
},
{
- "name": "CharacterController",
+ "name": "CharacterController2D",
"source": "ts",
"fields": [
{
@@ -853,7 +853,7 @@
]
},
{
- "name": "CircleCollider",
+ "name": "CircleCollider2D",
"source": "cpp",
"fields": [
{
@@ -946,7 +946,7 @@
"tag": true
},
{
- "name": "DistanceJoint",
+ "name": "DistanceJoint2D",
"source": "ts",
"fields": [
{
@@ -1835,7 +1835,7 @@
]
},
{
- "name": "MotorJoint",
+ "name": "MotorJoint2D",
"source": "ts",
"fields": [
{
@@ -2167,7 +2167,7 @@
"tag": true
},
{
- "name": "OneWayPlatform",
+ "name": "OneWayPlatform2D",
"source": "ts",
"fields": [
{
@@ -2747,7 +2747,7 @@
]
},
{
- "name": "PolygonCollider",
+ "name": "PolygonCollider2D",
"source": "ts",
"fields": [
{
@@ -2856,7 +2856,7 @@
]
},
{
- "name": "PrismaticJoint",
+ "name": "PrismaticJoint2D",
"source": "ts",
"fields": [
{
@@ -2972,7 +2972,7 @@
]
},
{
- "name": "RevoluteJoint",
+ "name": "RevoluteJoint2D",
"source": "ts",
"fields": [
{
@@ -3044,7 +3044,7 @@
]
},
{
- "name": "RigidBody",
+ "name": "RigidBody2D",
"source": "cpp",
"fields": [
{
@@ -3205,7 +3205,7 @@
]
},
{
- "name": "SegmentCollider",
+ "name": "SegmentCollider2D",
"source": "cpp",
"fields": [
{
@@ -4873,7 +4873,7 @@
]
},
{
- "name": "WeldJoint",
+ "name": "WeldJoint2D",
"source": "ts",
"fields": [
{
@@ -4935,7 +4935,7 @@
]
},
{
- "name": "WheelJoint",
+ "name": "WheelJoint2D",
"source": "ts",
"fields": [
{
diff --git a/examples/audio-demo/assets/scenes/main.esscene b/examples/audio-demo/assets/scenes/main.esscene
index 6da09a825..b5fb344d6 100644
--- a/examples/audio-demo/assets/scenes/main.esscene
+++ b/examples/audio-demo/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/camera-follow/assets/scenes/main.esscene b/examples/camera-follow/assets/scenes/main.esscene
index cc4a809aa..2a8abc242 100644
--- a/examples/camera-follow/assets/scenes/main.esscene
+++ b/examples/camera-follow/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/celestial-heights/assets/prefabs/wisp.esprefab b/examples/celestial-heights/assets/prefabs/wisp.esprefab
index bdbf4f669..4443eee7b 100644
--- a/examples/celestial-heights/assets/prefabs/wisp.esprefab
+++ b/examples/celestial-heights/assets/prefabs/wisp.esprefab
@@ -94,13 +94,13 @@
}
},
{
- "type": "RigidBody",
+ "type": "RigidBody2D",
"data": {
"bodyType": 1
}
},
{
- "type": "CircleCollider",
+ "type": "CircleCollider2D",
"data": {
"radius": 0.26,
"offset": {
diff --git a/examples/celestial-heights/assets/scenes/hud.esscene b/examples/celestial-heights/assets/scenes/hud.esscene
index dc7d5bfbb..bd534a3bc 100644
--- a/examples/celestial-heights/assets/scenes/hud.esscene
+++ b/examples/celestial-heights/assets/scenes/hud.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "hud",
"folders": [],
"entities": [
diff --git a/examples/celestial-heights/assets/scenes/main.esscene b/examples/celestial-heights/assets/scenes/main.esscene
index b626525f0..6c2ceb863 100644
--- a/examples/celestial-heights/assets/scenes/main.esscene
+++ b/examples/celestial-heights/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "main",
"folders": [
"Environment",
@@ -243,13 +243,13 @@
"data": {}
},
{
- "type": "RigidBody",
+ "type": "RigidBody2D",
"data": {
"bodyType": 1
}
},
{
- "type": "CircleCollider",
+ "type": "CircleCollider2D",
"data": {
"radius": 0.3,
"offset": {
@@ -261,7 +261,7 @@
}
},
{
- "type": "CharacterController",
+ "type": "CharacterController2D",
"data": {
"up": {
"x": 0,
diff --git a/examples/celestial-heights/assets/scenes/moonlit-gallery.esscene b/examples/celestial-heights/assets/scenes/moonlit-gallery.esscene
index 1633440f7..f368e69da 100644
--- a/examples/celestial-heights/assets/scenes/moonlit-gallery.esscene
+++ b/examples/celestial-heights/assets/scenes/moonlit-gallery.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "moonlit-gallery",
"folders": [
"Environment",
@@ -243,13 +243,13 @@
"data": {}
},
{
- "type": "RigidBody",
+ "type": "RigidBody2D",
"data": {
"bodyType": 1
}
},
{
- "type": "CircleCollider",
+ "type": "CircleCollider2D",
"data": {
"radius": 0.3,
"offset": {
@@ -261,7 +261,7 @@
}
},
{
- "type": "CharacterController",
+ "type": "CharacterController2D",
"data": {
"up": {
"x": 0,
diff --git a/examples/celestial-heights/assets/scenes/spire.esscene b/examples/celestial-heights/assets/scenes/spire.esscene
index 1f7d449f0..c781ec60f 100644
--- a/examples/celestial-heights/assets/scenes/spire.esscene
+++ b/examples/celestial-heights/assets/scenes/spire.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "spire",
"folders": [
"Environment",
@@ -370,13 +370,13 @@
"data": {}
},
{
- "type": "RigidBody",
+ "type": "RigidBody2D",
"data": {
"bodyType": 1
}
},
{
- "type": "CircleCollider",
+ "type": "CircleCollider2D",
"data": {
"radius": 0.3,
"offset": {
@@ -388,7 +388,7 @@
}
},
{
- "type": "CharacterController",
+ "type": "CharacterController2D",
"data": {
"up": {
"x": 0,
@@ -524,13 +524,13 @@
}
},
{
- "type": "RigidBody",
+ "type": "RigidBody2D",
"data": {
"bodyType": 1
}
},
{
- "type": "CircleCollider",
+ "type": "CircleCollider2D",
"data": {
"radius": 0.42,
"offset": {
@@ -542,7 +542,7 @@
}
},
{
- "type": "CharacterController",
+ "type": "CharacterController2D",
"data": {
"up": {
"x": 0,
diff --git a/examples/celestial-heights/src/systems/boss.ts b/examples/celestial-heights/src/systems/boss.ts
index 52d94afdd..6dd4b652e 100644
--- a/examples/celestial-heights/src/systems/boss.ts
+++ b/examples/celestial-heights/src/systems/boss.ts
@@ -1,6 +1,6 @@
import {
defineSystem, Query, Mut, Res, GetWorld,
- Transform, CharacterController, Prefabs, Time, Perception,
+ Transform, CharacterController2D, Prefabs, Time, Perception,
NavAgent, setNavDestination, stopNavAgent,
} from 'esengine';
import type { Entity } from 'esengine';
@@ -69,7 +69,7 @@ export const summonSystem = defineSystem(
*/
export const chargeSystem = defineSystem(
[
- Query(Mut(Charge), Mut(CharacterController), Mut(Facing), Transform, Perception),
+ Query(Mut(Charge), Mut(CharacterController2D), Mut(Facing), Transform, Perception),
Res(Time), GetWorld(),
],
(chargers, time, world) => {
diff --git a/examples/celestial-heights/src/systems/player.ts b/examples/celestial-heights/src/systems/player.ts
index d963a45fa..eec925419 100644
--- a/examples/celestial-heights/src/systems/player.ts
+++ b/examples/celestial-heights/src/systems/player.ts
@@ -1,4 +1,4 @@
-import { defineSystem, Query, Mut, CharacterController } from 'esengine';
+import { defineSystem, Query, Mut, CharacterController2D } from 'esengine';
import { Player, Facing, MeleeAttack } from '../components';
import { Actions } from '../actions';
import { DEPTH_FORESHORTEN } from '../config';
@@ -9,7 +9,7 @@ import { DEPTH_FORESHORTEN } from '../config';
* physics world's business and not this system's.
*/
export const playerMoveSystem = defineSystem(
- [Query(Mut(CharacterController), Mut(Facing), Player)],
+ [Query(Mut(CharacterController2D), Mut(Facing), Player)],
(players) => {
const move = Actions.axis2d('Move');
for (const [, cc, facing, player] of players) {
diff --git a/examples/chat/assets/scenes/main.esscene b/examples/chat/assets/scenes/main.esscene
index 60b09a981..d419bf70a 100644
--- a/examples/chat/assets/scenes/main.esscene
+++ b/examples/chat/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/collision-layers/assets/scenes/main.esscene b/examples/collision-layers/assets/scenes/main.esscene
index 2096e5c96..29e1901a5 100644
--- a/examples/collision-layers/assets/scenes/main.esscene
+++ b/examples/collision-layers/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
@@ -21,8 +21,8 @@
"components": [
{ "type": "Transform", "data": { "position": { "x": 0, "y": -250, "z": 0 } } },
{ "type": "Sprite", "data": { "size": { "x": 700, "y": 20 }, "color": { "r": 0.5, "g": 0.5, "b": 0.55, "a": 1 } } },
- { "type": "RigidBody", "data": { "bodyType": 0 } },
- { "type": "BoxCollider", "data": { "halfExtents": { "x": 3.5, "y": 0.1 }, "categoryBits": 8, "maskBits": 15 } }
+ { "type": "RigidBody2D", "data": { "bodyType": 0 } },
+ { "type": "BoxCollider2D", "data": { "halfExtents": { "x": 3.5, "y": 0.1 }, "categoryBits": 8, "maskBits": 15 } }
],
"visible": true
},
@@ -34,8 +34,8 @@
"components": [
{ "type": "Transform", "data": { "position": { "x": -200, "y": -100, "z": 0 } } },
{ "type": "Sprite", "data": { "size": { "x": 130, "y": 12 }, "color": { "r": 1, "g": 0.3, "b": 0.3, "a": 0.6 } } },
- { "type": "RigidBody", "data": { "bodyType": 0 } },
- { "type": "BoxCollider", "data": { "halfExtents": { "x": 0.65, "y": 0.06 }, "categoryBits": 1, "maskBits": 9 } }
+ { "type": "RigidBody2D", "data": { "bodyType": 0 } },
+ { "type": "BoxCollider2D", "data": { "halfExtents": { "x": 0.65, "y": 0.06 }, "categoryBits": 1, "maskBits": 9 } }
],
"visible": true
},
@@ -47,8 +47,8 @@
"components": [
{ "type": "Transform", "data": { "position": { "x": -200, "y": 50, "z": 0 } } },
{ "type": "Sprite", "data": { "size": { "x": 130, "y": 12 }, "color": { "r": 1, "g": 0.3, "b": 0.3, "a": 0.6 } } },
- { "type": "RigidBody", "data": { "bodyType": 0 } },
- { "type": "BoxCollider", "data": { "halfExtents": { "x": 0.65, "y": 0.06 }, "categoryBits": 1, "maskBits": 9 } }
+ { "type": "RigidBody2D", "data": { "bodyType": 0 } },
+ { "type": "BoxCollider2D", "data": { "halfExtents": { "x": 0.65, "y": 0.06 }, "categoryBits": 1, "maskBits": 9 } }
],
"visible": true
},
@@ -60,8 +60,8 @@
"components": [
{ "type": "Transform", "data": { "position": { "x": 0, "y": -100, "z": 0 } } },
{ "type": "Sprite", "data": { "size": { "x": 130, "y": 12 }, "color": { "r": 0.3, "g": 1, "b": 0.3, "a": 0.6 } } },
- { "type": "RigidBody", "data": { "bodyType": 0 } },
- { "type": "BoxCollider", "data": { "halfExtents": { "x": 0.65, "y": 0.06 }, "categoryBits": 2, "maskBits": 10 } }
+ { "type": "RigidBody2D", "data": { "bodyType": 0 } },
+ { "type": "BoxCollider2D", "data": { "halfExtents": { "x": 0.65, "y": 0.06 }, "categoryBits": 2, "maskBits": 10 } }
],
"visible": true
},
@@ -73,8 +73,8 @@
"components": [
{ "type": "Transform", "data": { "position": { "x": 0, "y": 50, "z": 0 } } },
{ "type": "Sprite", "data": { "size": { "x": 130, "y": 12 }, "color": { "r": 0.3, "g": 1, "b": 0.3, "a": 0.6 } } },
- { "type": "RigidBody", "data": { "bodyType": 0 } },
- { "type": "BoxCollider", "data": { "halfExtents": { "x": 0.65, "y": 0.06 }, "categoryBits": 2, "maskBits": 10 } }
+ { "type": "RigidBody2D", "data": { "bodyType": 0 } },
+ { "type": "BoxCollider2D", "data": { "halfExtents": { "x": 0.65, "y": 0.06 }, "categoryBits": 2, "maskBits": 10 } }
],
"visible": true
},
@@ -86,8 +86,8 @@
"components": [
{ "type": "Transform", "data": { "position": { "x": 200, "y": -100, "z": 0 } } },
{ "type": "Sprite", "data": { "size": { "x": 130, "y": 12 }, "color": { "r": 0.3, "g": 0.5, "b": 1, "a": 0.6 } } },
- { "type": "RigidBody", "data": { "bodyType": 0 } },
- { "type": "BoxCollider", "data": { "halfExtents": { "x": 0.65, "y": 0.06 }, "categoryBits": 4, "maskBits": 12 } }
+ { "type": "RigidBody2D", "data": { "bodyType": 0 } },
+ { "type": "BoxCollider2D", "data": { "halfExtents": { "x": 0.65, "y": 0.06 }, "categoryBits": 4, "maskBits": 12 } }
],
"visible": true
},
@@ -99,8 +99,8 @@
"components": [
{ "type": "Transform", "data": { "position": { "x": 200, "y": 50, "z": 0 } } },
{ "type": "Sprite", "data": { "size": { "x": 130, "y": 12 }, "color": { "r": 0.3, "g": 0.5, "b": 1, "a": 0.6 } } },
- { "type": "RigidBody", "data": { "bodyType": 0 } },
- { "type": "BoxCollider", "data": { "halfExtents": { "x": 0.65, "y": 0.06 }, "categoryBits": 4, "maskBits": 12 } }
+ { "type": "RigidBody2D", "data": { "bodyType": 0 } },
+ { "type": "BoxCollider2D", "data": { "halfExtents": { "x": 0.65, "y": 0.06 }, "categoryBits": 4, "maskBits": 12 } }
],
"visible": true
},
diff --git a/examples/collision-layers/src/systems/spawn.ts b/examples/collision-layers/src/systems/spawn.ts
index d4ba700d6..d3c6cd678 100644
--- a/examples/collision-layers/src/systems/spawn.ts
+++ b/examples/collision-layers/src/systems/spawn.ts
@@ -1,6 +1,6 @@
import {
defineSystem, Query, Mut, Res, Time, Commands,
- Transform, Sprite, RigidBody, CircleCollider, BodyType,
+ Transform, Sprite, RigidBody2D, CircleCollider2D, BodyType,
} from 'esengine';
import { SpawnTimer } from '../components';
@@ -40,10 +40,10 @@ export const spawnSystem = defineSystem(
size: { x: radius * 2, y: radius * 2 },
color: { ...layer.color, a: 1 },
})
- .insert(RigidBody, {
+ .insert(RigidBody2D, {
bodyType: BodyType.Dynamic,
})
- .insert(CircleCollider, {
+ .insert(CircleCollider2D, {
radius: radius / PPU,
restitution: 0.4,
categoryBits: layer.category,
diff --git a/examples/cutscene/assets/scenes/main.esscene b/examples/cutscene/assets/scenes/main.esscene
index bcfa6a91d..16be89d10 100644
--- a/examples/cutscene/assets/scenes/main.esscene
+++ b/examples/cutscene/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/dragonbones-demo/assets/scenes/main.esscene b/examples/dragonbones-demo/assets/scenes/main.esscene
index a6f51c5ce..bdea9bf16 100644
--- a/examples/dragonbones-demo/assets/scenes/main.esscene
+++ b/examples/dragonbones-demo/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "DragonBonesDemo",
"entities": [
{
diff --git a/examples/drawing-demo/assets/scenes/main.esscene b/examples/drawing-demo/assets/scenes/main.esscene
index 0148b4af0..fef496b51 100644
--- a/examples/drawing-demo/assets/scenes/main.esscene
+++ b/examples/drawing-demo/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/ecs-basics/assets/scenes/main.esscene b/examples/ecs-basics/assets/scenes/main.esscene
index 929007828..9cc86e4c0 100644
--- a/examples/ecs-basics/assets/scenes/main.esscene
+++ b/examples/ecs-basics/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/effects-gallery/assets/scenes/main.esscene b/examples/effects-gallery/assets/scenes/main.esscene
index 202ca9c73..a976003af 100644
--- a/examples/effects-gallery/assets/scenes/main.esscene
+++ b/examples/effects-gallery/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/enemy-ai-3d/assets/scenes/main.esscene b/examples/enemy-ai-3d/assets/scenes/main.esscene
index 3d66f1aa1..4f704d2ee 100644
--- a/examples/enemy-ai-3d/assets/scenes/main.esscene
+++ b/examples/enemy-ai-3d/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/enemy-ai/assets/scenes/main.esscene b/examples/enemy-ai/assets/scenes/main.esscene
index 2aac2a31d..b6ba85dd4 100644
--- a/examples/enemy-ai/assets/scenes/main.esscene
+++ b/examples/enemy-ai/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/event-system/assets/scenes/main.esscene b/examples/event-system/assets/scenes/main.esscene
index 929007828..9cc86e4c0 100644
--- a/examples/event-system/assets/scenes/main.esscene
+++ b/examples/event-system/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/hello-world/assets/scenes/main.esscene b/examples/hello-world/assets/scenes/main.esscene
index 7c48dd2d5..90981c65d 100644
--- a/examples/hello-world/assets/scenes/main.esscene
+++ b/examples/hello-world/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/hot-update-demo/assets/scenes/main.esscene b/examples/hot-update-demo/assets/scenes/main.esscene
index 4cd7ff770..c7fea11d4 100644
--- a/examples/hot-update-demo/assets/scenes/main.esscene
+++ b/examples/hot-update-demo/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/input-actions/assets/scenes/main.esscene b/examples/input-actions/assets/scenes/main.esscene
index 1ce77ea73..f507d10ec 100644
--- a/examples/input-actions/assets/scenes/main.esscene
+++ b/examples/input-actions/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/input-demo/assets/scenes/main.esscene b/examples/input-demo/assets/scenes/main.esscene
index b5737f9a7..e4adbed27 100644
--- a/examples/input-demo/assets/scenes/main.esscene
+++ b/examples/input-demo/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/lighting-2d/assets/scenes/main.esscene b/examples/lighting-2d/assets/scenes/main.esscene
index 91852133f..d097441bb 100644
--- a/examples/lighting-2d/assets/scenes/main.esscene
+++ b/examples/lighting-2d/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/lighting-3d/assets/scenes/main.esscene b/examples/lighting-3d/assets/scenes/main.esscene
index 1e7bdef76..8da9df341 100644
--- a/examples/lighting-3d/assets/scenes/main.esscene
+++ b/examples/lighting-3d/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/model-import/assets/scenes/main.esscene b/examples/model-import/assets/scenes/main.esscene
index 1c909322a..d17dd58b7 100644
--- a/examples/model-import/assets/scenes/main.esscene
+++ b/examples/model-import/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/multiplayer-arena/assets/scenes/main.esscene b/examples/multiplayer-arena/assets/scenes/main.esscene
index c0180267e..7c2fe2c3c 100644
--- a/examples/multiplayer-arena/assets/scenes/main.esscene
+++ b/examples/multiplayer-arena/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/particle-demo/assets/scenes/main.esscene b/examples/particle-demo/assets/scenes/main.esscene
index c2385c45d..ef89174ee 100644
--- a/examples/particle-demo/assets/scenes/main.esscene
+++ b/examples/particle-demo/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/particle-demo/assets/scenes/static-emitters.esscene b/examples/particle-demo/assets/scenes/static-emitters.esscene
index e96327c67..763a60656 100644
--- a/examples/particle-demo/assets/scenes/static-emitters.esscene
+++ b/examples/particle-demo/assets/scenes/static-emitters.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Static Emitters",
"entities": [
{
diff --git a/examples/physics-3d/assets/scenes/main.esscene b/examples/physics-3d/assets/scenes/main.esscene
index 70f3c3788..603a2f7f1 100644
--- a/examples/physics-3d/assets/scenes/main.esscene
+++ b/examples/physics-3d/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/physics-playground/assets/scenes/main.esscene b/examples/physics-playground/assets/scenes/main.esscene
index 77891ad7d..639facc00 100644
--- a/examples/physics-playground/assets/scenes/main.esscene
+++ b/examples/physics-playground/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
@@ -21,8 +21,8 @@
"components": [
{ "type": "Transform", "data": { "position": { "x": 0, "y": -250, "z": 0 } } },
{ "type": "Sprite", "data": { "size": { "x": 700, "y": 20 }, "color": { "r": 0.4, "g": 0.4, "b": 0.45, "a": 1 } } },
- { "type": "RigidBody", "data": { "bodyType": 0 } },
- { "type": "BoxCollider", "data": { "halfExtents": { "x": 3.5, "y": 0.1 } } }
+ { "type": "RigidBody2D", "data": { "bodyType": 0 } },
+ { "type": "BoxCollider2D", "data": { "halfExtents": { "x": 3.5, "y": 0.1 } } }
],
"visible": true
},
@@ -34,8 +34,8 @@
"components": [
{ "type": "Transform", "data": { "position": { "x": -350, "y": -50, "z": 0 } } },
{ "type": "Sprite", "data": { "size": { "x": 20, "y": 400 }, "color": { "r": 0.4, "g": 0.4, "b": 0.45, "a": 1 } } },
- { "type": "RigidBody", "data": { "bodyType": 0 } },
- { "type": "BoxCollider", "data": { "halfExtents": { "x": 0.1, "y": 2.0 } } }
+ { "type": "RigidBody2D", "data": { "bodyType": 0 } },
+ { "type": "BoxCollider2D", "data": { "halfExtents": { "x": 0.1, "y": 2.0 } } }
],
"visible": true
},
@@ -47,8 +47,8 @@
"components": [
{ "type": "Transform", "data": { "position": { "x": 350, "y": -50, "z": 0 } } },
{ "type": "Sprite", "data": { "size": { "x": 20, "y": 400 }, "color": { "r": 0.4, "g": 0.4, "b": 0.45, "a": 1 } } },
- { "type": "RigidBody", "data": { "bodyType": 0 } },
- { "type": "BoxCollider", "data": { "halfExtents": { "x": 0.1, "y": 2.0 } } }
+ { "type": "RigidBody2D", "data": { "bodyType": 0 } },
+ { "type": "BoxCollider2D", "data": { "halfExtents": { "x": 0.1, "y": 2.0 } } }
],
"visible": true
},
@@ -60,8 +60,8 @@
"components": [
{ "type": "Transform", "data": { "position": { "x": -80, "y": -100, "z": 0 }, "rotation": { "w": 0.966, "x": 0, "y": 0, "z": 0.259 } } },
{ "type": "Sprite", "data": { "size": { "x": 250, "y": 14 }, "color": { "r": 0.5, "g": 0.5, "b": 0.55, "a": 1 } } },
- { "type": "RigidBody", "data": { "bodyType": 0 } },
- { "type": "BoxCollider", "data": { "halfExtents": { "x": 1.25, "y": 0.07 } } }
+ { "type": "RigidBody2D", "data": { "bodyType": 0 } },
+ { "type": "BoxCollider2D", "data": { "halfExtents": { "x": 1.25, "y": 0.07 } } }
],
"visible": true
},
diff --git a/examples/physics-playground/assets/scenes/showcase.esscene b/examples/physics-playground/assets/scenes/showcase.esscene
index a6d8be7c9..b1d20542c 100644
--- a/examples/physics-playground/assets/scenes/showcase.esscene
+++ b/examples/physics-playground/assets/scenes/showcase.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Showcase",
"entities": [
{
@@ -21,8 +21,8 @@
"components": [
{ "type": "Transform", "data": { "position": { "x": 0, "y": -260, "z": 0 } } },
{ "type": "Sprite", "data": { "size": { "x": 780, "y": 20 }, "color": { "r": 0.4, "g": 0.4, "b": 0.45, "a": 1 } } },
- { "type": "RigidBody", "data": { "bodyType": 0 } },
- { "type": "BoxCollider", "data": { "halfExtents": { "x": 3.9, "y": 0.1 } } }
+ { "type": "RigidBody2D", "data": { "bodyType": 0 } },
+ { "type": "BoxCollider2D", "data": { "halfExtents": { "x": 3.9, "y": 0.1 } } }
],
"visible": true
},
@@ -34,8 +34,8 @@
"components": [
{ "type": "Transform", "data": { "position": { "x": -390, "y": -20, "z": 0 } } },
{ "type": "Sprite", "data": { "size": { "x": 20, "y": 520 }, "color": { "r": 0.4, "g": 0.4, "b": 0.45, "a": 1 } } },
- { "type": "RigidBody", "data": { "bodyType": 0 } },
- { "type": "BoxCollider", "data": { "halfExtents": { "x": 0.1, "y": 2.6 } } }
+ { "type": "RigidBody2D", "data": { "bodyType": 0 } },
+ { "type": "BoxCollider2D", "data": { "halfExtents": { "x": 0.1, "y": 2.6 } } }
],
"visible": true
},
@@ -47,8 +47,8 @@
"components": [
{ "type": "Transform", "data": { "position": { "x": 390, "y": -20, "z": 0 } } },
{ "type": "Sprite", "data": { "size": { "x": 20, "y": 520 }, "color": { "r": 0.4, "g": 0.4, "b": 0.45, "a": 1 } } },
- { "type": "RigidBody", "data": { "bodyType": 0 } },
- { "type": "BoxCollider", "data": { "halfExtents": { "x": 0.1, "y": 2.6 } } }
+ { "type": "RigidBody2D", "data": { "bodyType": 0 } },
+ { "type": "BoxCollider2D", "data": { "halfExtents": { "x": 0.1, "y": 2.6 } } }
],
"visible": true
},
@@ -60,9 +60,9 @@
"components": [
{ "type": "Transform", "data": { "position": { "x": -170, "y": 30, "z": 0 } } },
{ "type": "Sprite", "data": { "size": { "x": 300, "y": 16 }, "color": { "r": 0.3, "g": 0.8, "b": 0.9, "a": 0.55 } } },
- { "type": "RigidBody", "data": { "bodyType": 0 } },
- { "type": "BoxCollider", "data": { "halfExtents": { "x": 1.5, "y": 0.08 } } },
- { "type": "OneWayPlatform", "data": { "normal": { "x": 0, "y": 1 }, "enabled": true } }
+ { "type": "RigidBody2D", "data": { "bodyType": 0 } },
+ { "type": "BoxCollider2D", "data": { "halfExtents": { "x": 1.5, "y": 0.08 } } },
+ { "type": "OneWayPlatform2D", "data": { "normal": { "x": 0, "y": 1 }, "enabled": true } }
],
"visible": true
},
@@ -73,7 +73,7 @@
"children": [],
"components": [
{ "type": "Transform", "data": { "position": { "x": 150, "y": -90, "z": 0 } } },
- { "type": "RigidBody", "data": { "bodyType": 0 } }
+ { "type": "RigidBody2D", "data": { "bodyType": 0 } }
],
"visible": true
},
@@ -85,9 +85,9 @@
"components": [
{ "type": "Transform", "data": { "position": { "x": 150, "y": -90, "z": 0 } } },
{ "type": "Sprite", "data": { "size": { "x": 160, "y": 24 }, "color": { "r": 0.95, "g": 0.6, "b": 0.2, "a": 1 } } },
- { "type": "RigidBody", "data": { "bodyType": 2, "fixedRotation": true } },
- { "type": "BoxCollider", "data": { "halfExtents": { "x": 0.8, "y": 0.12 }, "friction": 0.8 } },
- { "type": "MotorJoint", "data": {
+ { "type": "RigidBody2D", "data": { "bodyType": 2, "fixedRotation": true } },
+ { "type": "BoxCollider2D", "data": { "halfExtents": { "x": 0.8, "y": 0.12 }, "friction": 0.8 } },
+ { "type": "MotorJoint2D", "data": {
"connectedEntity": 5,
"linearVelocity": { "x": 180, "y": 0 },
"maxVelocityForce": 3000,
@@ -123,7 +123,7 @@
"children": [],
"components": [
{ "type": "Transform", "data": { "position": { "x": 300, "y": 80, "z": 0 } } },
- { "type": "RigidBody", "data": { "bodyType": 0 } }
+ { "type": "RigidBody2D", "data": { "bodyType": 0 } }
],
"visible": true
},
@@ -135,9 +135,9 @@
"components": [
{ "type": "Transform", "data": { "position": { "x": 300, "y": 40, "z": 0 } } },
{ "type": "Sprite", "data": { "size": { "x": 100, "y": 16 }, "color": { "r": 0.65, "g": 0.5, "b": 0.95, "a": 1 } } },
- { "type": "RigidBody", "data": { "bodyType": 2, "fixedRotation": true } },
- { "type": "BoxCollider", "data": { "halfExtents": { "x": 0.5, "y": 0.08 } } },
- { "type": "PrismaticJoint", "data": {
+ { "type": "RigidBody2D", "data": { "bodyType": 2, "fixedRotation": true } },
+ { "type": "BoxCollider2D", "data": { "halfExtents": { "x": 0.5, "y": 0.08 } } },
+ { "type": "PrismaticJoint2D", "data": {
"connectedEntity": 8,
"anchorA": { "x": 0, "y": 0 },
"anchorB": { "x": 0, "y": 0 },
diff --git a/examples/physics-playground/src/systems/interact.ts b/examples/physics-playground/src/systems/interact.ts
index 9ed0cc940..d9ca73171 100644
--- a/examples/physics-playground/src/systems/interact.ts
+++ b/examples/physics-playground/src/systems/interact.ts
@@ -1,9 +1,9 @@
import {
defineSystem, Query, Res, Input, UICameraInfo,
- Transform, RigidBody, BodyType,
+ Transform, RigidBody2D, BodyType,
} from 'esengine';
-import type { UICameraData, RigidBodyData, TransformData } from 'esengine';
-import { Physics, MotorJoint } from 'esengine/physics';
+import type { UICameraData, RigidBody2DData, TransformData } from 'esengine';
+import { Physics, MotorJoint2D } from 'esengine/physics';
import type { PhysicsAPI } from 'esengine/physics';
const DRAG_BUTTON = 0;
@@ -12,14 +12,14 @@ const PICK_RADIUS = 6; // world px around the cursor to grab a body
// Click-and-drag any dynamic body with a mouse joint: pick on press, follow the
// cursor while held, release on up. Only one drag is live at a time.
export const dragSystem = defineSystem(
- [Res(Input), Res(UICameraInfo), Res(Physics), Query(RigidBody)],
+ [Res(Input), Res(UICameraInfo), Res(Physics), Query(RigidBody2D)],
(input, camera: UICameraData, physics: PhysicsAPI, bodies) => {
if (!camera.valid) return;
const target = { x: camera.worldMouseX, y: camera.worldMouseY };
if (input.isMouseButtonPressed(DRAG_BUTTON) && !physics.hasMouseJoint()) {
const dynamic = new Set<number>();
- for (const [entity, rb] of bodies as Iterable<[number, RigidBodyData]>) {
+ for (const [entity, rb] of bodies as Iterable<[number, RigidBody2DData]>) {
if (rb.bodyType === BodyType.Dynamic) dynamic.add(entity);
}
const hit = physics.overlapCircle(target, PICK_RADIUS).find((e) => dynamic.has(e));
@@ -41,7 +41,7 @@ const SHUTTLE_MAX_X = 290;
const shuttleDir = new Map<number, number>();
export const shuttleSystem = defineSystem(
- [Res(Physics), Query(Transform, MotorJoint)],
+ [Res(Physics), Query(Transform, MotorJoint2D)],
(physics: PhysicsAPI, shuttles) => {
for (const [entity, transform] of shuttles as Iterable<[number, TransformData]>) {
let dir = shuttleDir.get(entity) ?? 1;
diff --git a/examples/physics-playground/src/systems/spawn.ts b/examples/physics-playground/src/systems/spawn.ts
index 8b7037c6a..520190f15 100644
--- a/examples/physics-playground/src/systems/spawn.ts
+++ b/examples/physics-playground/src/systems/spawn.ts
@@ -1,7 +1,7 @@
import {
defineSystem, Query, Mut, Res, Time, Commands,
Transform, ShapeRenderer, ShapeType,
- RigidBody, BoxCollider, CircleCollider, CapsuleCollider, BodyType,
+ RigidBody2D, BoxCollider2D, CircleCollider2D, CapsuleCollider2D, BodyType,
} from 'esengine';
import { SpawnTimer } from '../components';
@@ -35,8 +35,8 @@ export const spawnSystem = defineSystem(
size: { x: d, y: d },
color,
})
- .insert(RigidBody, { bodyType: BodyType.Dynamic })
- .insert(CircleCollider, {
+ .insert(RigidBody2D, { bodyType: BodyType.Dynamic })
+ .insert(CircleCollider2D, {
radius: r / PPU,
restitution: 0.2 + Math.random() * 0.4,
});
@@ -50,8 +50,8 @@ export const spawnSystem = defineSystem(
size: { x: w, y: h },
color,
})
- .insert(RigidBody, { bodyType: BodyType.Dynamic })
- .insert(CapsuleCollider, {
+ .insert(RigidBody2D, { bodyType: BodyType.Dynamic })
+ .insert(CapsuleCollider2D, {
radius: (w / 2) / PPU,
halfHeight: ((h - w) / 2) / PPU,
restitution: 0.2 + Math.random() * 0.4,
@@ -68,8 +68,8 @@ export const spawnSystem = defineSystem(
cornerRadius: cr,
color,
})
- .insert(RigidBody, { bodyType: BodyType.Dynamic })
- .insert(BoxCollider, {
+ .insert(RigidBody2D, { bodyType: BodyType.Dynamic })
+ .insert(BoxCollider2D, {
halfExtents: { x: w / 2 / PPU, y: h / 2 / PPU },
restitution: 0.2 + Math.random() * 0.4,
});
diff --git a/examples/physics-spinner/assets/scenes/main.esscene b/examples/physics-spinner/assets/scenes/main.esscene
index 595630d3b..3563ad1c9 100644
--- a/examples/physics-spinner/assets/scenes/main.esscene
+++ b/examples/physics-spinner/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
@@ -20,7 +20,7 @@
"children": [],
"components": [
{ "type": "Transform", "data": { "position": { "x": 0, "y": 1200, "z": 0 } } },
- { "type": "RigidBody", "data": { "bodyType": 0 } }
+ { "type": "RigidBody2D", "data": { "bodyType": 0 } }
],
"visible": true
},
@@ -32,9 +32,9 @@
"components": [
{ "type": "Transform", "data": { "position": { "x": 0, "y": 1200, "z": 0 } } },
{ "type": "Sprite", "data": { "size": { "x": 120, "y": 4040 }, "color": { "r": 0.9, "g": 0.3, "b": 0.2, "a": 1 } } },
- { "type": "RigidBody", "data": { "bodyType": 2 } },
- { "type": "BoxCollider", "data": { "halfExtents": { "x": 0.4, "y": 20.0 }, "radius": 0.2, "friction": 0.0 } },
- { "type": "RevoluteJoint", "data": {
+ { "type": "RigidBody2D", "data": { "bodyType": 2 } },
+ { "type": "BoxCollider2D", "data": { "halfExtents": { "x": 0.4, "y": 20.0 }, "radius": 0.2, "friction": 0.0 } },
+ { "type": "RevoluteJoint2D", "data": {
"connectedEntity": 1,
"anchorA": { "x": 0, "y": 0 },
"anchorB": { "x": 0, "y": 0 },
diff --git a/examples/physics-spinner/src/systems/spawn.ts b/examples/physics-spinner/src/systems/spawn.ts
index 0fa7795b9..c6f189d4a 100644
--- a/examples/physics-spinner/src/systems/spawn.ts
+++ b/examples/physics-spinner/src/systems/spawn.ts
@@ -1,7 +1,7 @@
import {
defineSystem, Query, Mut, Commands,
Transform, ShapeRenderer, ShapeType,
- RigidBody, BoxCollider, CircleCollider, CapsuleCollider, ChainCollider, BodyType,
+ RigidBody2D, BoxCollider2D, CircleCollider2D, CapsuleCollider2D, ChainCollider2D, BodyType,
} from 'esengine';
import { SpawnMarker } from '../components';
@@ -49,8 +49,8 @@ export const spawnSystem = defineSystem(
cmds.spawn()
.insert(Transform, { position: { x: 0, y: 0, z: 0 } })
- .insert(RigidBody, { bodyType: BodyType.Static })
- .insert(ChainCollider, {
+ .insert(RigidBody2D, { bodyType: BodyType.Static })
+ .insert(ChainCollider2D, {
points: generateArenaPoints(),
isLoop: true,
friction: 0.1,
@@ -77,8 +77,8 @@ export const spawnSystem = defineSystem(
size: { x: w, y: h },
color: { r: 0.9, g: 0.55, b: 0.2, a: 1 },
})
- .insert(RigidBody, { bodyType: BodyType.Dynamic })
- .insert(CapsuleCollider, {
+ .insert(RigidBody2D, { bodyType: BodyType.Dynamic })
+ .insert(CapsuleCollider2D, {
radius: capsuleRadius,
halfHeight: capsuleHalfLen,
density: 0.25,
@@ -95,8 +95,8 @@ export const spawnSystem = defineSystem(
size: { x: d, y: d },
color: { r: 0.3, g: 0.7, b: 0.9, a: 1 },
})
- .insert(RigidBody, { bodyType: BodyType.Dynamic })
- .insert(CircleCollider, {
+ .insert(RigidBody2D, { bodyType: BodyType.Dynamic })
+ .insert(CircleCollider2D, {
radius: r,
density: 0.25,
friction: 0.1,
@@ -113,8 +113,8 @@ export const spawnSystem = defineSystem(
cornerRadius: 2,
color: { r: 0.2, g: 0.85, b: 0.4, a: 1 },
})
- .insert(RigidBody, { bodyType: BodyType.Dynamic })
- .insert(BoxCollider, {
+ .insert(RigidBody2D, { bodyType: BodyType.Dynamic })
+ .insert(BoxCollider2D, {
halfExtents: { x: half, y: half },
density: 0.25,
friction: 0.1,
diff --git a/examples/platformer/assets/prefabs/Coin.esprefab b/examples/platformer/assets/prefabs/Coin.esprefab
index 41f4104c0..0ad2eae37 100644
--- a/examples/platformer/assets/prefabs/Coin.esprefab
+++ b/examples/platformer/assets/prefabs/Coin.esprefab
@@ -12,8 +12,8 @@
{ "type": "Transform", "data": { "position": { "x": 0, "y": 0, "z": 0 } } },
{ "type": "Sprite", "data": { "size": { "x": 24, "y": 24 }, "color": { "r": 1, "g": 0.85, "b": 0, "a": 1 }, "texture": "@uuid:c18959bd-f6be-49d3-945b-3d6ecf8ef14f" } },
{ "type": "Coin", "data": { "baseY": 0, "bobTimer": 0 } },
- { "type": "RigidBody", "data": { "bodyType": 0 } },
- { "type": "BoxCollider", "data": { "halfExtents": { "x": 0.12, "y": 0.12 }, "isSensor": true, "categoryBits": 2, "maskBits": 65535 } }
+ { "type": "RigidBody2D", "data": { "bodyType": 0 } },
+ { "type": "BoxCollider2D", "data": { "halfExtents": { "x": 0.12, "y": 0.12 }, "isSensor": true, "categoryBits": 2, "maskBits": 65535 } }
],
"visible": true
}
diff --git a/examples/platformer/assets/scenes/main.esscene b/examples/platformer/assets/scenes/main.esscene
index c98b5730f..279ea89af 100644
--- a/examples/platformer/assets/scenes/main.esscene
+++ b/examples/platformer/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"folders": [
"Environment",
@@ -101,13 +101,13 @@
}
},
{
- "type": "RigidBody",
+ "type": "RigidBody2D",
"data": {
"bodyType": 0
}
},
{
- "type": "BoxCollider",
+ "type": "BoxCollider2D",
"data": {
"halfExtents": {
"x": 4,
@@ -154,13 +154,13 @@
}
},
{
- "type": "RigidBody",
+ "type": "RigidBody2D",
"data": {
"bodyType": 0
}
},
{
- "type": "BoxCollider",
+ "type": "BoxCollider2D",
"data": {
"halfExtents": {
"x": 0.8,
@@ -207,13 +207,13 @@
}
},
{
- "type": "RigidBody",
+ "type": "RigidBody2D",
"data": {
"bodyType": 0
}
},
{
- "type": "BoxCollider",
+ "type": "BoxCollider2D",
"data": {
"halfExtents": {
"x": 0.8,
@@ -260,13 +260,13 @@
}
},
{
- "type": "RigidBody",
+ "type": "RigidBody2D",
"data": {
"bodyType": 0
}
},
{
- "type": "BoxCollider",
+ "type": "BoxCollider2D",
"data": {
"halfExtents": {
"x": 1,
@@ -313,13 +313,13 @@
}
},
{
- "type": "RigidBody",
+ "type": "RigidBody2D",
"data": {
"bodyType": 0
}
},
{
- "type": "BoxCollider",
+ "type": "BoxCollider2D",
"data": {
"halfExtents": {
"x": 0.7,
@@ -350,13 +350,13 @@
}
},
{
- "type": "RigidBody",
+ "type": "RigidBody2D",
"data": {
"bodyType": 0
}
},
{
- "type": "BoxCollider",
+ "type": "BoxCollider2D",
"data": {
"halfExtents": {
"x": 0.1,
@@ -387,13 +387,13 @@
}
},
{
- "type": "RigidBody",
+ "type": "RigidBody2D",
"data": {
"bodyType": 0
}
},
{
- "type": "BoxCollider",
+ "type": "BoxCollider2D",
"data": {
"halfExtents": {
"x": 0.1,
@@ -444,13 +444,13 @@
"data": {}
},
{
- "type": "RigidBody",
+ "type": "RigidBody2D",
"data": {
"bodyType": 1
}
},
{
- "type": "BoxCollider",
+ "type": "BoxCollider2D",
"data": {
"halfExtents": {
"x": 0.16,
@@ -461,7 +461,7 @@
}
},
{
- "type": "CharacterController",
+ "type": "CharacterController2D",
"data": {
"maskBits": 65533
}
diff --git a/examples/platformer/src/systems/player.ts b/examples/platformer/src/systems/player.ts
index 4d4a9bc93..80919568a 100644
--- a/examples/platformer/src/systems/player.ts
+++ b/examples/platformer/src/systems/player.ts
@@ -1,13 +1,13 @@
import {
defineSystem, Query, Mut, Res, Time, Input,
- CharacterController,
+ CharacterController2D,
} from 'esengine';
import { Player } from '../components';
const GRAVITY = -1600;
export const playerSystem = defineSystem(
- [Query(Mut(CharacterController), Player), Res(Time), Res(Input)],
+ [Query(Mut(CharacterController2D), Player), Res(Time), Res(Input)],
(players, time, input) => {
for (const [_entity, cc, player] of players) {
let moveX = 0;
diff --git a/examples/postprocess-effects/assets/scenes/main.esscene b/examples/postprocess-effects/assets/scenes/main.esscene
index afd21d853..42038bea9 100644
--- a/examples/postprocess-effects/assets/scenes/main.esscene
+++ b/examples/postprocess-effects/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/render-texture/assets/scenes/main.esscene b/examples/render-texture/assets/scenes/main.esscene
index cc4a809aa..2a8abc242 100644
--- a/examples/render-texture/assets/scenes/main.esscene
+++ b/examples/render-texture/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/rich-text/assets/scenes/main.esscene b/examples/rich-text/assets/scenes/main.esscene
index 8d7807be4..c28f3ddd4 100644
--- a/examples/rich-text/assets/scenes/main.esscene
+++ b/examples/rich-text/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/save-load/assets/scenes/main.esscene b/examples/save-load/assets/scenes/main.esscene
index 62c801b33..3ac0a6398 100644
--- a/examples/save-load/assets/scenes/main.esscene
+++ b/examples/save-load/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/scene-flow/assets/scenes/main.esscene b/examples/scene-flow/assets/scenes/main.esscene
index 8162fd03c..fe86b2823 100644
--- a/examples/scene-flow/assets/scenes/main.esscene
+++ b/examples/scene-flow/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/space-shooter/assets/scenes/main.esscene b/examples/space-shooter/assets/scenes/main.esscene
index 480b24df3..103b160fb 100644
--- a/examples/space-shooter/assets/scenes/main.esscene
+++ b/examples/space-shooter/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/spine-demo/assets/scenes/aran.esscene b/examples/spine-demo/assets/scenes/aran.esscene
index ce43bada5..713c3840b 100644
--- a/examples/spine-demo/assets/scenes/aran.esscene
+++ b/examples/spine-demo/assets/scenes/aran.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "AranShowcase",
"entities": [
{
diff --git a/examples/spine-demo/assets/scenes/main.esscene b/examples/spine-demo/assets/scenes/main.esscene
index 135bd0701..d508c4769 100644
--- a/examples/spine-demo/assets/scenes/main.esscene
+++ b/examples/spine-demo/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "SpineDemo",
"entities": [
{
diff --git a/examples/sprite-animation/assets/scenes/coins.esscene b/examples/sprite-animation/assets/scenes/coins.esscene
index c27b9db72..76d38f635 100644
--- a/examples/sprite-animation/assets/scenes/coins.esscene
+++ b/examples/sprite-animation/assets/scenes/coins.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Coins",
"entities": [
{
diff --git a/examples/sprite-animation/assets/scenes/main.esscene b/examples/sprite-animation/assets/scenes/main.esscene
index 3f8822d05..99d29cdf1 100644
--- a/examples/sprite-animation/assets/scenes/main.esscene
+++ b/examples/sprite-animation/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/sprite-rendering/assets/scenes/main.esscene b/examples/sprite-rendering/assets/scenes/main.esscene
index 141b703f0..e84f9aba5 100644
--- a/examples/sprite-rendering/assets/scenes/main.esscene
+++ b/examples/sprite-rendering/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/tilemap-demo/assets/scenes/hex-map.esscene b/examples/tilemap-demo/assets/scenes/hex-map.esscene
index 9ac012be9..9f6d445ba 100644
--- a/examples/tilemap-demo/assets/scenes/hex-map.esscene
+++ b/examples/tilemap-demo/assets/scenes/hex-map.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Tilemap Demo",
"entities": [
{
diff --git a/examples/tilemap-demo/assets/scenes/iso-map.esscene b/examples/tilemap-demo/assets/scenes/iso-map.esscene
index 3c76e6589..6ff6c1ff1 100644
--- a/examples/tilemap-demo/assets/scenes/iso-map.esscene
+++ b/examples/tilemap-demo/assets/scenes/iso-map.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Tilemap Demo",
"entities": [
{
diff --git a/examples/tilemap-demo/assets/scenes/native-map.esscene b/examples/tilemap-demo/assets/scenes/native-map.esscene
index 54c0b51b5..cd81a6b19 100644
--- a/examples/tilemap-demo/assets/scenes/native-map.esscene
+++ b/examples/tilemap-demo/assets/scenes/native-map.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "NativeMap",
"entities": [
{
@@ -107,9 +107,9 @@
{ "type": "Transform", "data": { "position": { "x": 90, "y": -170, "z": 1 } } },
{ "type": "Sprite", "data": { "size": { "x": 18, "y": 18 }, "texture": "@uuid:33875408-2450-4071-bad2-d54ead703b8b", "layer": 5 } },
{ "type": "Player", "data": {} },
- { "type": "RigidBody", "data": { "bodyType": 1 } },
- { "type": "BoxCollider", "data": { "halfExtents": { "x": 0.07, "y": 0.08 }, "categoryBits": 1, "maskBits": 65535 } },
- { "type": "CharacterController", "data": { "maskBits": 65535 } }
+ { "type": "RigidBody2D", "data": { "bodyType": 1 } },
+ { "type": "BoxCollider2D", "data": { "halfExtents": { "x": 0.07, "y": 0.08 }, "categoryBits": 1, "maskBits": 65535 } },
+ { "type": "CharacterController2D", "data": { "maskBits": 65535 } }
],
"visible": true
}
diff --git a/examples/tilemap-demo/assets/scenes/staggered-map.esscene b/examples/tilemap-demo/assets/scenes/staggered-map.esscene
index 4ca6c94a8..ba192bf9f 100644
--- a/examples/tilemap-demo/assets/scenes/staggered-map.esscene
+++ b/examples/tilemap-demo/assets/scenes/staggered-map.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Tilemap Demo",
"entities": [
{
diff --git a/examples/tilemap-demo/assets/scenes/tiled-map.esscene b/examples/tilemap-demo/assets/scenes/tiled-map.esscene
index 67fda173e..18c258fc2 100644
--- a/examples/tilemap-demo/assets/scenes/tiled-map.esscene
+++ b/examples/tilemap-demo/assets/scenes/tiled-map.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "TiledMap",
"entities": [
{
@@ -99,9 +99,9 @@
{ "type": "Transform", "data": { "position": { "x": 90, "y": -170, "z": 1 } } },
{ "type": "Sprite", "data": { "size": { "x": 18, "y": 18 }, "texture": "@uuid:33875408-2450-4071-bad2-d54ead703b8b", "layer": 5 } },
{ "type": "Player", "data": {} },
- { "type": "RigidBody", "data": { "bodyType": 1 } },
- { "type": "BoxCollider", "data": { "halfExtents": { "x": 0.07, "y": 0.08 }, "categoryBits": 1, "maskBits": 65535 } },
- { "type": "CharacterController", "data": { "maskBits": 65535 } }
+ { "type": "RigidBody2D", "data": { "bodyType": 1 } },
+ { "type": "BoxCollider2D", "data": { "halfExtents": { "x": 0.07, "y": 0.08 }, "categoryBits": 1, "maskBits": 65535 } },
+ { "type": "CharacterController2D", "data": { "maskBits": 65535 } }
],
"visible": true
}
diff --git a/examples/tilemap-demo/assets/scenes/wang-map.esscene b/examples/tilemap-demo/assets/scenes/wang-map.esscene
index c3335e0dc..6e75377ce 100644
--- a/examples/tilemap-demo/assets/scenes/wang-map.esscene
+++ b/examples/tilemap-demo/assets/scenes/wang-map.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Tilemap Demo",
"entities": [
{
diff --git a/examples/tilemap-demo/src/systems/player.ts b/examples/tilemap-demo/src/systems/player.ts
index b15e1a74c..9d5739c25 100644
--- a/examples/tilemap-demo/src/systems/player.ts
+++ b/examples/tilemap-demo/src/systems/player.ts
@@ -1,6 +1,6 @@
import {
defineSystem, Query, Mut, Res, Time, Input,
- CharacterController,
+ CharacterController2D,
} from 'esengine';
import { Player } from '../components';
@@ -9,7 +9,7 @@ import { Player } from '../components';
const GRAVITY = -1200;
export const playerSystem = defineSystem(
- [Query(Mut(CharacterController), Player), Res(Time), Res(Input)],
+ [Query(Mut(CharacterController2D), Player), Res(Time), Res(Input)],
(players, time, input) => {
for (const [, cc, player] of players) {
let moveX = 0;
diff --git a/examples/tilemap-demo/src/systems/respawn.ts b/examples/tilemap-demo/src/systems/respawn.ts
index 892a2af57..602ab0ba6 100644
--- a/examples/tilemap-demo/src/systems/respawn.ts
+++ b/examples/tilemap-demo/src/systems/respawn.ts
@@ -1,5 +1,5 @@
import {
- defineSystem, Query, Mut, Transform, CharacterController,
+ defineSystem, Query, Mut, Transform, CharacterController2D,
} from 'esengine';
import { Player } from '../components';
@@ -12,7 +12,7 @@ const DEATH_Y = -360;
const homes = new Map<number, { x: number; y: number }>();
export const respawnSystem = defineSystem(
- [Query(Mut(Transform), Mut(CharacterController), Player)],
+ [Query(Mut(Transform), Mut(CharacterController2D), Player)],
(players) => {
for (const [entity, tf, cc] of players) {
let home = homes.get(entity);
diff --git a/examples/timers-demo/assets/scenes/main.esscene b/examples/timers-demo/assets/scenes/main.esscene
index 2d8759ab4..8509e520b 100644
--- a/examples/timers-demo/assets/scenes/main.esscene
+++ b/examples/timers-demo/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/trail-demo/assets/scenes/main.esscene b/examples/trail-demo/assets/scenes/main.esscene
index fbcfa46b4..b75ef7bf7 100644
--- a/examples/trail-demo/assets/scenes/main.esscene
+++ b/examples/trail-demo/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/tween-animation/assets/scenes/main.esscene b/examples/tween-animation/assets/scenes/main.esscene
index 2eda8e143..1bf32dd41 100644
--- a/examples/tween-animation/assets/scenes/main.esscene
+++ b/examples/tween-animation/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/ui-controller/assets/scenes/authoring.esscene b/examples/ui-controller/assets/scenes/authoring.esscene
index f1062e3dd..9409868e5 100644
--- a/examples/ui-controller/assets/scenes/authoring.esscene
+++ b/examples/ui-controller/assets/scenes/authoring.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "UI Controllers & Gears",
"entities": [
{
diff --git a/examples/ui-controller/assets/scenes/main.esscene b/examples/ui-controller/assets/scenes/main.esscene
index bf50d0fe4..8eedf85d4 100644
--- a/examples/ui-controller/assets/scenes/main.esscene
+++ b/examples/ui-controller/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/ui-controls/assets/scenes/main.esscene b/examples/ui-controls/assets/scenes/main.esscene
index 26f65d800..6d2946e46 100644
--- a/examples/ui-controls/assets/scenes/main.esscene
+++ b/examples/ui-controls/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/ui-events/assets/scenes/main.esscene b/examples/ui-events/assets/scenes/main.esscene
index 7a53a3931..6d83c2877 100644
--- a/examples/ui-events/assets/scenes/main.esscene
+++ b/examples/ui-events/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "UI Events (no code)",
"entities": [
{
diff --git a/examples/ui-interaction/assets/scenes/main.esscene b/examples/ui-interaction/assets/scenes/main.esscene
index 8a292eaa3..30594a296 100644
--- a/examples/ui-interaction/assets/scenes/main.esscene
+++ b/examples/ui-interaction/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/ui-layout/assets/scenes/main.esscene b/examples/ui-layout/assets/scenes/main.esscene
index 82d9a1440..6e73bad46 100644
--- a/examples/ui-layout/assets/scenes/main.esscene
+++ b/examples/ui-layout/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/ui-list/assets/scenes/main.esscene b/examples/ui-list/assets/scenes/main.esscene
index 3b0d10aa2..460aacae4 100644
--- a/examples/ui-list/assets/scenes/main.esscene
+++ b/examples/ui-list/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/video-playback/assets/scenes/main.esscene b/examples/video-playback/assets/scenes/main.esscene
index 39967cd10..7a987b4ed 100644
--- a/examples/video-playback/assets/scenes/main.esscene
+++ b/examples/video-playback/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/examples/video-puzzle/assets/scenes/main.esscene b/examples/video-puzzle/assets/scenes/main.esscene
index 9c511ea88..7cf8beb5a 100644
--- a/examples/video-puzzle/assets/scenes/main.esscene
+++ b/examples/video-puzzle/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/fixtures/scenes/bitmaptext.esscene b/fixtures/scenes/bitmaptext.esscene
index c151908c9..c422bad0b 100644
--- a/fixtures/scenes/bitmaptext.esscene
+++ b/fixtures/scenes/bitmaptext.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "BitmapTextGate",
"entities": [
{
diff --git a/fixtures/scenes/bloom-ldr.esscene b/fixtures/scenes/bloom-ldr.esscene
index e41e33e5f..fc863bb4d 100644
--- a/fixtures/scenes/bloom-ldr.esscene
+++ b/fixtures/scenes/bloom-ldr.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "HDR Bloom",
"entities": [
{
diff --git a/fixtures/scenes/camera-culling.esscene b/fixtures/scenes/camera-culling.esscene
index 02ed0ac39..74ed95a1d 100644
--- a/fixtures/scenes/camera-culling.esscene
+++ b/fixtures/scenes/camera-culling.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Camera.cullingMask drops whole layers: the HUD (its Canvas is on layer 1) and the blue sprite (layer 2) are cleared from the mask, leaving only the green world on layer 0.",
"entities": [
{
diff --git a/fixtures/scenes/camera-parent.esscene b/fixtures/scenes/camera-parent.esscene
index 73d1c69da..465676979 100644
--- a/fixtures/scenes/camera-parent.esscene
+++ b/fixtures/scenes/camera-parent.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "CameraParent",
"entities": [
{
diff --git a/fixtures/scenes/camera-target.esscene b/fixtures/scenes/camera-target.esscene
index b42828684..26e528a25 100644
--- a/fixtures/scenes/camera-target.esscene
+++ b/fixtures/scenes/camera-target.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "CameraTarget",
"entities": [
{
diff --git a/fixtures/scenes/camera-tilt.esscene b/fixtures/scenes/camera-tilt.esscene
index 7a6fa9018..731f2844b 100644
--- a/fixtures/scenes/camera-tilt.esscene
+++ b/fixtures/scenes/camera-tilt.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "CameraTilt",
"entities": [
{
diff --git a/fixtures/scenes/depth-layers.esscene b/fixtures/scenes/depth-layers.esscene
index 2476b5b5c..187d4c24d 100644
--- a/fixtures/scenes/depth-layers.esscene
+++ b/fixtures/scenes/depth-layers.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "DepthLayers",
"entities": [
{
diff --git a/fixtures/scenes/dragonbones-test.esscene b/fixtures/scenes/dragonbones-test.esscene
index 02a2f5429..0413be515 100644
--- a/fixtures/scenes/dragonbones-test.esscene
+++ b/fixtures/scenes/dragonbones-test.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "DragonBonesTest",
"entities": [
{
diff --git a/fixtures/scenes/hdr-bloom.esscene b/fixtures/scenes/hdr-bloom.esscene
index e46b24400..0148c9e30 100644
--- a/fixtures/scenes/hdr-bloom.esscene
+++ b/fixtures/scenes/hdr-bloom.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "HDR Bloom",
"entities": [
{
diff --git a/fixtures/scenes/ktx2-orientation.esscene b/fixtures/scenes/ktx2-orientation.esscene
index cfcc03b14..c25a79ba4 100644
--- a/fixtures/scenes/ktx2-orientation.esscene
+++ b/fixtures/scenes/ktx2-orientation.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "KTX2 Orientation",
"entities": [
{
diff --git a/fixtures/scenes/ktx2-sprite.esscene b/fixtures/scenes/ktx2-sprite.esscene
index c3fd3f099..30debaf01 100644
--- a/fixtures/scenes/ktx2-sprite.esscene
+++ b/fixtures/scenes/ktx2-sprite.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "KTX2 Sprite",
"entities": [
{
diff --git a/fixtures/scenes/lut-grade.esscene b/fixtures/scenes/lut-grade.esscene
index d6f4232f8..85ba2e721 100644
--- a/fixtures/scenes/lut-grade.esscene
+++ b/fixtures/scenes/lut-grade.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "LutGrade",
"entities": [
{
diff --git a/fixtures/scenes/mat-builtin-lit.esscene b/fixtures/scenes/mat-builtin-lit.esscene
index 6c4654306..f19f0a332 100644
--- a/fixtures/scenes/mat-builtin-lit.esscene
+++ b/fixtures/scenes/mat-builtin-lit.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/fixtures/scenes/mat-dissolve.esscene b/fixtures/scenes/mat-dissolve.esscene
index c76ef2419..c2b568941 100644
--- a/fixtures/scenes/mat-dissolve.esscene
+++ b/fixtures/scenes/mat-dissolve.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/fixtures/scenes/mat-env-mirror.esscene b/fixtures/scenes/mat-env-mirror.esscene
index b37ece5cb..81c1f07ed 100644
--- a/fixtures/scenes/mat-env-mirror.esscene
+++ b/fixtures/scenes/mat-env-mirror.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/fixtures/scenes/mat-env.esscene b/fixtures/scenes/mat-env.esscene
index 8ad28fdd7..929e9974e 100644
--- a/fixtures/scenes/mat-env.esscene
+++ b/fixtures/scenes/mat-env.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/fixtures/scenes/mat-graph.esscene b/fixtures/scenes/mat-graph.esscene
index 0311d3b50..54c828925 100644
--- a/fixtures/scenes/mat-graph.esscene
+++ b/fixtures/scenes/mat-graph.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/fixtures/scenes/mat-instance.esscene b/fixtures/scenes/mat-instance.esscene
index e52c1d17c..4d00adb26 100644
--- a/fixtures/scenes/mat-instance.esscene
+++ b/fixtures/scenes/mat-instance.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/fixtures/scenes/mat-lit-flatnormal.esscene b/fixtures/scenes/mat-lit-flatnormal.esscene
index 48fa9788a..220f52cbe 100644
--- a/fixtures/scenes/mat-lit-flatnormal.esscene
+++ b/fixtures/scenes/mat-lit-flatnormal.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/fixtures/scenes/mat-lit-normal.esscene b/fixtures/scenes/mat-lit-normal.esscene
index 6fd12f844..ec7acccc0 100644
--- a/fixtures/scenes/mat-lit-normal.esscene
+++ b/fixtures/scenes/mat-lit-normal.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/fixtures/scenes/mat-lit-point.esscene b/fixtures/scenes/mat-lit-point.esscene
index 53dd5dbfd..1041b8f7f 100644
--- a/fixtures/scenes/mat-lit-point.esscene
+++ b/fixtures/scenes/mat-lit-point.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/fixtures/scenes/mat-lit-shadow-dir.esscene b/fixtures/scenes/mat-lit-shadow-dir.esscene
index b3c5c5b4b..069d3b620 100644
--- a/fixtures/scenes/mat-lit-shadow-dir.esscene
+++ b/fixtures/scenes/mat-lit-shadow-dir.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/fixtures/scenes/mat-lit-shadow-hard.esscene b/fixtures/scenes/mat-lit-shadow-hard.esscene
index 1fd415d8a..9aece6e27 100644
--- a/fixtures/scenes/mat-lit-shadow-hard.esscene
+++ b/fixtures/scenes/mat-lit-shadow-hard.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/fixtures/scenes/mat-lit-shadow-soft.esscene b/fixtures/scenes/mat-lit-shadow-soft.esscene
index fdacf5098..0427b5152 100644
--- a/fixtures/scenes/mat-lit-shadow-soft.esscene
+++ b/fixtures/scenes/mat-lit-shadow-soft.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/fixtures/scenes/mat-lit-shadow.esscene b/fixtures/scenes/mat-lit-shadow.esscene
index 1d09a109a..48fac7318 100644
--- a/fixtures/scenes/mat-lit-shadow.esscene
+++ b/fixtures/scenes/mat-lit-shadow.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/fixtures/scenes/mat-lit-spot.esscene b/fixtures/scenes/mat-lit-spot.esscene
index 95ad79c0b..4f0bcd4e3 100644
--- a/fixtures/scenes/mat-lit-spot.esscene
+++ b/fixtures/scenes/mat-lit-spot.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/fixtures/scenes/mat-lit.esscene b/fixtures/scenes/mat-lit.esscene
index 1d6bc0c4b..e45e12dad 100644
--- a/fixtures/scenes/mat-lit.esscene
+++ b/fixtures/scenes/mat-lit.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/fixtures/scenes/mat-model-env.esscene b/fixtures/scenes/mat-model-env.esscene
index cee2fe470..d0d5fdbc5 100644
--- a/fixtures/scenes/mat-model-env.esscene
+++ b/fixtures/scenes/mat-model-env.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/fixtures/scenes/mat-model.esscene b/fixtures/scenes/mat-model.esscene
index c8d83431a..5472e5a6a 100644
--- a/fixtures/scenes/mat-model.esscene
+++ b/fixtures/scenes/mat-model.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/fixtures/scenes/mat-pbr.esscene b/fixtures/scenes/mat-pbr.esscene
index d6da93147..69336847a 100644
--- a/fixtures/scenes/mat-pbr.esscene
+++ b/fixtures/scenes/mat-pbr.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/fixtures/scenes/mat-sw.esscene b/fixtures/scenes/mat-sw.esscene
index c44c56032..b31b06b92 100644
--- a/fixtures/scenes/mat-sw.esscene
+++ b/fixtures/scenes/mat-sw.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/fixtures/scenes/mat-tex.esscene b/fixtures/scenes/mat-tex.esscene
index 90199584e..f5213133d 100644
--- a/fixtures/scenes/mat-tex.esscene
+++ b/fixtures/scenes/mat-tex.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/fixtures/scenes/mat-tint.esscene b/fixtures/scenes/mat-tint.esscene
index 33862b052..4fe2dbfdc 100644
--- a/fixtures/scenes/mat-tint.esscene
+++ b/fixtures/scenes/mat-tint.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/fixtures/scenes/mesh-builtin.esscene b/fixtures/scenes/mesh-builtin.esscene
index 3eaa0f574..beb844ebc 100644
--- a/fixtures/scenes/mesh-builtin.esscene
+++ b/fixtures/scenes/mesh-builtin.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "MeshBuiltin",
"entities": [
{
diff --git a/fixtures/scenes/mesh-depth-through-capture.esscene b/fixtures/scenes/mesh-depth-through-capture.esscene
index ebf319efb..6dda8d7c7 100644
--- a/fixtures/scenes/mesh-depth-through-capture.esscene
+++ b/fixtures/scenes/mesh-depth-through-capture.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "MeshDepthThroughCapture",
"entities": [
{
diff --git a/fixtures/scenes/mesh-depth.esscene b/fixtures/scenes/mesh-depth.esscene
index 8056ee4f5..5622bf719 100644
--- a/fixtures/scenes/mesh-depth.esscene
+++ b/fixtures/scenes/mesh-depth.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "MeshDepth",
"entities": [
{
diff --git a/fixtures/scenes/mesh-flat-lit.esscene b/fixtures/scenes/mesh-flat-lit.esscene
index 6fcb033bc..80c28cb18 100644
--- a/fixtures/scenes/mesh-flat-lit.esscene
+++ b/fixtures/scenes/mesh-flat-lit.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "MeshFlatLit",
"entities": [
{
diff --git a/fixtures/scenes/mesh-flat-point-3d.esscene b/fixtures/scenes/mesh-flat-point-3d.esscene
index f80880596..f0c793e2f 100644
--- a/fixtures/scenes/mesh-flat-point-3d.esscene
+++ b/fixtures/scenes/mesh-flat-point-3d.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "MeshFlatPoint3D",
"entities": [
{
diff --git a/fixtures/scenes/mesh-instanced.esscene b/fixtures/scenes/mesh-instanced.esscene
index a311f9d08..cb29aadc3 100644
--- a/fixtures/scenes/mesh-instanced.esscene
+++ b/fixtures/scenes/mesh-instanced.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "MeshInstanced",
"entities": [
{
diff --git a/fixtures/scenes/mesh-lit.esscene b/fixtures/scenes/mesh-lit.esscene
index 5dbf94190..93414ef65 100644
--- a/fixtures/scenes/mesh-lit.esscene
+++ b/fixtures/scenes/mesh-lit.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "MeshLit",
"entities": [
{
diff --git a/fixtures/scenes/mesh-material.esscene b/fixtures/scenes/mesh-material.esscene
index 9d0198979..f0ef4278a 100644
--- a/fixtures/scenes/mesh-material.esscene
+++ b/fixtures/scenes/mesh-material.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "MeshMaterial",
"entities": [
{
diff --git a/fixtures/scenes/mesh-nodes.esscene b/fixtures/scenes/mesh-nodes.esscene
index 197158c8a..5a0c3c426 100644
--- a/fixtures/scenes/mesh-nodes.esscene
+++ b/fixtures/scenes/mesh-nodes.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "MeshNodes",
"entities": [
{
diff --git a/fixtures/scenes/mesh-normalmap.esscene b/fixtures/scenes/mesh-normalmap.esscene
index b66ee3743..c4e436c2f 100644
--- a/fixtures/scenes/mesh-normalmap.esscene
+++ b/fixtures/scenes/mesh-normalmap.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "MeshNormalMap",
"entities": [
{
diff --git a/fixtures/scenes/mesh-point-3d.esscene b/fixtures/scenes/mesh-point-3d.esscene
index 491b0bcf4..5f5b74ff2 100644
--- a/fixtures/scenes/mesh-point-3d.esscene
+++ b/fixtures/scenes/mesh-point-3d.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "MeshPoint3D",
"entities": [
{
diff --git a/fixtures/scenes/mesh-renderer.esscene b/fixtures/scenes/mesh-renderer.esscene
index ce898017e..e8a7ae86b 100644
--- a/fixtures/scenes/mesh-renderer.esscene
+++ b/fixtures/scenes/mesh-renderer.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "MeshRenderer",
"entities": [
{
diff --git a/fixtures/scenes/mesh-shadow-aimed.esscene b/fixtures/scenes/mesh-shadow-aimed.esscene
index f740208ab..ea149df0c 100644
--- a/fixtures/scenes/mesh-shadow-aimed.esscene
+++ b/fixtures/scenes/mesh-shadow-aimed.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "MeshShadowAimed",
"entities": [
{
diff --git a/fixtures/scenes/mesh-shadow-cascade.esscene b/fixtures/scenes/mesh-shadow-cascade.esscene
index 40fcbf8e7..d510909e1 100644
--- a/fixtures/scenes/mesh-shadow-cascade.esscene
+++ b/fixtures/scenes/mesh-shadow-cascade.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "MeshShadowCascade",
"entities": [
{
diff --git a/fixtures/scenes/mesh-shadow-caster-behind.esscene b/fixtures/scenes/mesh-shadow-caster-behind.esscene
index 9be614ac1..f57c59b09 100644
--- a/fixtures/scenes/mesh-shadow-caster-behind.esscene
+++ b/fixtures/scenes/mesh-shadow-caster-behind.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "MeshShadowCasterBehind",
"entities": [
{
diff --git a/fixtures/scenes/mesh-shadow-material.esscene b/fixtures/scenes/mesh-shadow-material.esscene
index ac949c6a8..9cfe7501c 100644
--- a/fixtures/scenes/mesh-shadow-material.esscene
+++ b/fixtures/scenes/mesh-shadow-material.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "MeshShadowMaterial",
"entities": [
{
diff --git a/fixtures/scenes/mesh-shadow-perspective.esscene b/fixtures/scenes/mesh-shadow-perspective.esscene
index a14907fe3..43be568e2 100644
--- a/fixtures/scenes/mesh-shadow-perspective.esscene
+++ b/fixtures/scenes/mesh-shadow-perspective.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "MeshShadowPerspective",
"entities": [
{
diff --git a/fixtures/scenes/mesh-shadow.esscene b/fixtures/scenes/mesh-shadow.esscene
index 42f797771..65e84fd97 100644
--- a/fixtures/scenes/mesh-shadow.esscene
+++ b/fixtures/scenes/mesh-shadow.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "MeshShadow",
"entities": [
{
diff --git a/fixtures/scenes/mesh-skin-mat.esscene b/fixtures/scenes/mesh-skin-mat.esscene
index 0f0a77621..7374c70ed 100644
--- a/fixtures/scenes/mesh-skin-mat.esscene
+++ b/fixtures/scenes/mesh-skin-mat.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "MeshSkinMaterial",
"entities": [
{
diff --git a/fixtures/scenes/mesh-skin.esscene b/fixtures/scenes/mesh-skin.esscene
index 56081ad29..fe3d3fd69 100644
--- a/fixtures/scenes/mesh-skin.esscene
+++ b/fixtures/scenes/mesh-skin.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "MeshSkin",
"entities": [
{
diff --git a/fixtures/scenes/mesh-sky.esscene b/fixtures/scenes/mesh-sky.esscene
index 284d7984b..4f468162f 100644
--- a/fixtures/scenes/mesh-sky.esscene
+++ b/fixtures/scenes/mesh-sky.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "MeshSky",
"entities": [
{
diff --git a/fixtures/scenes/mesh-textured.esscene b/fixtures/scenes/mesh-textured.esscene
index d0556d8ae..b7de45caf 100644
--- a/fixtures/scenes/mesh-textured.esscene
+++ b/fixtures/scenes/mesh-textured.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "MeshTextured",
"entities": [
{
diff --git a/fixtures/scenes/model-animation.esscene b/fixtures/scenes/model-animation.esscene
index 6f703df38..57c33fa28 100644
--- a/fixtures/scenes/model-animation.esscene
+++ b/fixtures/scenes/model-animation.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "ModelAnimation",
"entities": [
{
diff --git a/fixtures/scenes/model-material.esscene b/fixtures/scenes/model-material.esscene
index 3f2565ad8..2d5c7ec94 100644
--- a/fixtures/scenes/model-material.esscene
+++ b/fixtures/scenes/model-material.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "ModelMaterial",
"entities": [
{
diff --git a/fixtures/scenes/ortho-clip-behind-camera.esscene b/fixtures/scenes/ortho-clip-behind-camera.esscene
index da1ee7b62..18ce63e86 100644
--- a/fixtures/scenes/ortho-clip-behind-camera.esscene
+++ b/fixtures/scenes/ortho-clip-behind-camera.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "OrthoClipBehindCamera",
"entities": [
{
diff --git a/fixtures/scenes/parallax-control.esscene b/fixtures/scenes/parallax-control.esscene
index 9dbedd3e3..c594a2435 100644
--- a/fixtures/scenes/parallax-control.esscene
+++ b/fixtures/scenes/parallax-control.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/fixtures/scenes/parallax-shape.esscene b/fixtures/scenes/parallax-shape.esscene
index 5ccd8c20f..214204963 100644
--- a/fixtures/scenes/parallax-shape.esscene
+++ b/fixtures/scenes/parallax-shape.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "ParallaxShape",
"entities": [
{
diff --git a/fixtures/scenes/parallax.esscene b/fixtures/scenes/parallax.esscene
index bf73eed30..fa20eb4f1 100644
--- a/fixtures/scenes/parallax.esscene
+++ b/fixtures/scenes/parallax.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/fixtures/scenes/particle-billboard.esscene b/fixtures/scenes/particle-billboard.esscene
index 73ec7c8a3..48a0010f0 100644
--- a/fixtures/scenes/particle-billboard.esscene
+++ b/fixtures/scenes/particle-billboard.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "ParticleBillboard",
"entities": [
{
diff --git a/fixtures/scenes/particle-collision.esscene b/fixtures/scenes/particle-collision.esscene
index 7a60e43a2..3c0d76117 100644
--- a/fixtures/scenes/particle-collision.esscene
+++ b/fixtures/scenes/particle-collision.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "ParticleCollision",
"entities": [
{
diff --git a/fixtures/scenes/particle-demo.esscene b/fixtures/scenes/particle-demo.esscene
index b511e7611..8c67d7ae7 100644
--- a/fixtures/scenes/particle-demo.esscene
+++ b/fixtures/scenes/particle-demo.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/fixtures/scenes/particle-forcefield.esscene b/fixtures/scenes/particle-forcefield.esscene
index 54d2a1c75..faed544a6 100644
--- a/fixtures/scenes/particle-forcefield.esscene
+++ b/fixtures/scenes/particle-forcefield.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "ParticleForceField",
"entities": [
{
diff --git a/fixtures/scenes/particle-gradient.esscene b/fixtures/scenes/particle-gradient.esscene
index 8b8394aec..2644f3787 100644
--- a/fixtures/scenes/particle-gradient.esscene
+++ b/fixtures/scenes/particle-gradient.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "ParticleGradient",
"entities": [
{
diff --git a/fixtures/scenes/particle-material.esscene b/fixtures/scenes/particle-material.esscene
index f103d9fda..8c5051eba 100644
--- a/fixtures/scenes/particle-material.esscene
+++ b/fixtures/scenes/particle-material.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "ParticleMaterial",
"entities": [
{
diff --git a/fixtures/scenes/particle-sizecurve.esscene b/fixtures/scenes/particle-sizecurve.esscene
index aca16a783..a253c726a 100644
--- a/fixtures/scenes/particle-sizecurve.esscene
+++ b/fixtures/scenes/particle-sizecurve.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "ParticleSizeCurve",
"entities": [
{
diff --git a/fixtures/scenes/particle-trail.esscene b/fixtures/scenes/particle-trail.esscene
index e097318e9..87b03ed70 100644
--- a/fixtures/scenes/particle-trail.esscene
+++ b/fixtures/scenes/particle-trail.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "ParticleTrail",
"entities": [
{
diff --git a/fixtures/scenes/pixel-perfect.esscene b/fixtures/scenes/pixel-perfect.esscene
index fb711a5f2..2097fe279 100644
--- a/fixtures/scenes/pixel-perfect.esscene
+++ b/fixtures/scenes/pixel-perfect.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/fixtures/scenes/point-shadow.esscene b/fixtures/scenes/point-shadow.esscene
index b57f12d8b..78cdda6f6 100644
--- a/fixtures/scenes/point-shadow.esscene
+++ b/fixtures/scenes/point-shadow.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "PointShadow",
"entities": [
{
diff --git a/fixtures/scenes/postprocess-effects.esscene b/fixtures/scenes/postprocess-effects.esscene
index 49d9e2a45..dcc9537bb 100644
--- a/fixtures/scenes/postprocess-effects.esscene
+++ b/fixtures/scenes/postprocess-effects.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/fixtures/scenes/soft-shadow-contact.esscene b/fixtures/scenes/soft-shadow-contact.esscene
index 6e450491a..9ea67705c 100644
--- a/fixtures/scenes/soft-shadow-contact.esscene
+++ b/fixtures/scenes/soft-shadow-contact.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "SoftShadowContact",
"entities": [
{
diff --git a/fixtures/scenes/soft-shadow.esscene b/fixtures/scenes/soft-shadow.esscene
index bc09965a1..ca6d0baa8 100644
--- a/fixtures/scenes/soft-shadow.esscene
+++ b/fixtures/scenes/soft-shadow.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "SoftShadow",
"entities": [
{
diff --git a/fixtures/scenes/sort-view-depth.esscene b/fixtures/scenes/sort-view-depth.esscene
index 9a0f14326..9bebf66ce 100644
--- a/fixtures/scenes/sort-view-depth.esscene
+++ b/fixtures/scenes/sort-view-depth.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "SortViewDepth",
"entities": [
{
diff --git a/fixtures/scenes/spine-test.esscene b/fixtures/scenes/spine-test.esscene
index 01bd60f03..5309ca3b9 100644
--- a/fixtures/scenes/spine-test.esscene
+++ b/fixtures/scenes/spine-test.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "SpineTest",
"entities": [
{
diff --git a/fixtures/scenes/spot-shadow.esscene b/fixtures/scenes/spot-shadow.esscene
index f194715b0..beee8bff4 100644
--- a/fixtures/scenes/spot-shadow.esscene
+++ b/fixtures/scenes/spot-shadow.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "SpotShadow",
"entities": [
{
diff --git a/fixtures/scenes/sprite-lit.esscene b/fixtures/scenes/sprite-lit.esscene
index eca534acc..fd4d07381 100644
--- a/fixtures/scenes/sprite-lit.esscene
+++ b/fixtures/scenes/sprite-lit.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/fixtures/scenes/sprite-rendering.esscene b/fixtures/scenes/sprite-rendering.esscene
index bd7400e59..0f5528ae8 100644
--- a/fixtures/scenes/sprite-rendering.esscene
+++ b/fixtures/scenes/sprite-rendering.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/fixtures/scenes/srgb-midtone.esscene b/fixtures/scenes/srgb-midtone.esscene
index 2136fdb41..a4fe40d7e 100644
--- a/fixtures/scenes/srgb-midtone.esscene
+++ b/fixtures/scenes/srgb-midtone.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "sRGB Midtone Roundtrip",
"entities": [
{
diff --git a/fixtures/scenes/sun-shadow-contact.esscene b/fixtures/scenes/sun-shadow-contact.esscene
index 4b1dc307e..23df0c389 100644
--- a/fixtures/scenes/sun-shadow-contact.esscene
+++ b/fixtures/scenes/sun-shadow-contact.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "SunShadowContact",
"entities": [
{
diff --git a/fixtures/scenes/sun-shadow.esscene b/fixtures/scenes/sun-shadow.esscene
index 5a45486a0..a66866c25 100644
--- a/fixtures/scenes/sun-shadow.esscene
+++ b/fixtures/scenes/sun-shadow.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "SunShadow",
"entities": [
{
diff --git a/fixtures/scenes/tilemap-flip.esscene b/fixtures/scenes/tilemap-flip.esscene
index 871542d1c..e7571a30b 100644
--- a/fixtures/scenes/tilemap-flip.esscene
+++ b/fixtures/scenes/tilemap-flip.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "TilemapFlip",
"entities": [
{
diff --git a/fixtures/scenes/tilemap-gidobj.esscene b/fixtures/scenes/tilemap-gidobj.esscene
index 6f4452a9c..3b5675daa 100644
--- a/fixtures/scenes/tilemap-gidobj.esscene
+++ b/fixtures/scenes/tilemap-gidobj.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "TilemapGidObject",
"entities": [
{
diff --git a/fixtures/scenes/tilemap-hex.esscene b/fixtures/scenes/tilemap-hex.esscene
index 8bfc9ea93..f76755767 100644
--- a/fixtures/scenes/tilemap-hex.esscene
+++ b/fixtures/scenes/tilemap-hex.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "TilemapHex",
"entities": [
{
diff --git a/fixtures/scenes/tilemap-multiset.esscene b/fixtures/scenes/tilemap-multiset.esscene
index b0d4f36de..b800b6e10 100644
--- a/fixtures/scenes/tilemap-multiset.esscene
+++ b/fixtures/scenes/tilemap-multiset.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "TilemapMultiset",
"entities": [
{
diff --git a/fixtures/scenes/tilemap-oob.esscene b/fixtures/scenes/tilemap-oob.esscene
index b2c0161f4..f7a7be016 100644
--- a/fixtures/scenes/tilemap-oob.esscene
+++ b/fixtures/scenes/tilemap-oob.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "TilemapOutOfRange",
"entities": [
{
diff --git a/fixtures/scenes/tilemap-parallax.esscene b/fixtures/scenes/tilemap-parallax.esscene
index 3563092c2..538742aa4 100644
--- a/fixtures/scenes/tilemap-parallax.esscene
+++ b/fixtures/scenes/tilemap-parallax.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "TilemapParallax",
"entities": [
{
diff --git a/fixtures/scenes/tilemap-spacing.esscene b/fixtures/scenes/tilemap-spacing.esscene
index c6ab07bed..579b4f20d 100644
--- a/fixtures/scenes/tilemap-spacing.esscene
+++ b/fixtures/scenes/tilemap-spacing.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "TilemapSpacing",
"entities": [
{
diff --git a/fixtures/scenes/tilemap-transform.esscene b/fixtures/scenes/tilemap-transform.esscene
index afcadc63b..375646735 100644
--- a/fixtures/scenes/tilemap-transform.esscene
+++ b/fixtures/scenes/tilemap-transform.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "TilemapTransform",
"entities": [
{
diff --git a/fixtures/scenes/trail.esscene b/fixtures/scenes/trail.esscene
index ee007a7d4..23c63940d 100644
--- a/fixtures/scenes/trail.esscene
+++ b/fixtures/scenes/trail.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Trail",
"entities": [
{
diff --git a/fixtures/scenes/ui-layout.esscene b/fixtures/scenes/ui-layout.esscene
index d761f5979..4a496da51 100644
--- a/fixtures/scenes/ui-layout.esscene
+++ b/fixtures/scenes/ui-layout.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/fixtures/scenes/ui-list-mask.esscene b/fixtures/scenes/ui-list-mask.esscene
index 8438ac38e..723a0b40c 100644
--- a/fixtures/scenes/ui-list-mask.esscene
+++ b/fixtures/scenes/ui-list-mask.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "UIMask (Scissor) clips overflowing content to the viewport — the primitive createListView relies on",
"entities": [
{
diff --git a/fixtures/scenes/ui-node-absolute.esscene b/fixtures/scenes/ui-node-absolute.esscene
index 390f3352e..a28e2d717 100644
--- a/fixtures/scenes/ui-node-absolute.esscene
+++ b/fixtures/scenes/ui-node-absolute.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "UINode absolute positioning / inset (REARCH_GUI F3 unification)",
"entities": [
{
diff --git a/fixtures/scenes/ui-node-flex.esscene b/fixtures/scenes/ui-node-flex.esscene
index 78726e2a4..513e66718 100644
--- a/fixtures/scenes/ui-node-flex.esscene
+++ b/fixtures/scenes/ui-node-flex.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "UINode single-pass flex layout (REARCH_GUI F3.2)",
"entities": [
{
diff --git a/fixtures/scenes/ui-screen-root.esscene b/fixtures/scenes/ui-screen-root.esscene
index 85e499b09..0f23da9e3 100644
--- a/fixtures/scenes/ui-screen-root.esscene
+++ b/fixtures/scenes/ui-screen-root.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Screen root tracks the camera; parented UI rides its parent. The camera starts at the origin and is driven away at runtime, so the layout box moves without resizing.",
"entities": [
{
diff --git a/fixtures/scenes/ui-text-effects.esscene b/fixtures/scenes/ui-text-effects.esscene
index cf10dd4f7..a23cbef9c 100644
--- a/fixtures/scenes/ui-text-effects.esscene
+++ b/fixtures/scenes/ui-text-effects.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "SDF text outline + shadow (REARCH_GUI F8)",
"entities": [
{
diff --git a/fixtures/scenes/ui-text-overflow.esscene b/fixtures/scenes/ui-text-overflow.esscene
index 5d30828ed..9b31e688b 100644
--- a/fixtures/scenes/ui-text-overflow.esscene
+++ b/fixtures/scenes/ui-text-overflow.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "TextOverflow — Visible beside Clip",
"entities": [
{
diff --git a/fixtures/scenes/ui-text-rect.esscene b/fixtures/scenes/ui-text-rect.esscene
index 5e4734ca1..4760e1a9f 100644
--- a/fixtures/scenes/ui-text-rect.esscene
+++ b/fixtures/scenes/ui-text-rect.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "SDF Text in UIRect",
"entities": [
{
diff --git a/fixtures/scenes/ui-text-sdf.esscene b/fixtures/scenes/ui-text-sdf.esscene
index 414b5f107..93ea54b06 100644
--- a/fixtures/scenes/ui-text-sdf.esscene
+++ b/fixtures/scenes/ui-text-sdf.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "SDF Text Verify",
"entities": [
{
diff --git a/fixtures/scenes/ui-text-uinode.esscene b/fixtures/scenes/ui-text-uinode.esscene
index 18fda2a34..7d4c127d2 100644
--- a/fixtures/scenes/ui-text-uinode.esscene
+++ b/fixtures/scenes/ui-text-uinode.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Text laid out in a UINode box (REARCH_GUI S1)",
"entities": [
{
diff --git a/fixtures/scenes/ui-text-zorder.esscene b/fixtures/scenes/ui-text-zorder.esscene
index 59540a5dc..bb40c96e1 100644
--- a/fixtures/scenes/ui-text-zorder.esscene
+++ b/fixtures/scenes/ui-text-zorder.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "SDF Text z-order over UI",
"entities": [
{
diff --git a/fixtures/scenes/ui-textinput.esscene b/fixtures/scenes/ui-textinput.esscene
index ae8743094..3b2fb7100 100644
--- a/fixtures/scenes/ui-textinput.esscene
+++ b/fixtures/scenes/ui-textinput.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "SDF TextInput (REARCH_GUI F8)",
"entities": [
{
diff --git a/fixtures/scenes/ui-visual-filled.esscene b/fixtures/scenes/ui-visual-filled.esscene
index c5935ed0c..b9b301643 100644
--- a/fixtures/scenes/ui-visual-filled.esscene
+++ b/fixtures/scenes/ui-visual-filled.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "UIVisual Filled — geometry+UV crop reveals a solid/textured fill along fillMethod/fillOrigin (progress/slider basis)",
"entities": [
{
diff --git a/fixtures/scenes/video-playback.esscene b/fixtures/scenes/video-playback.esscene
index e322ad43a..0704bb72c 100644
--- a/fixtures/scenes/video-playback.esscene
+++ b/fixtures/scenes/video-playback.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "VideoPlayback",
"entities": [
{
diff --git a/fixtures/scenes/video-ui.esscene b/fixtures/scenes/video-ui.esscene
index 02ed2c521..0bd22e2cd 100644
--- a/fixtures/scenes/video-ui.esscene
+++ b/fixtures/scenes/video-ui.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "VideoUI",
"entities": [
{
diff --git a/fixtures/scenes/ysort.esscene b/fixtures/scenes/ysort.esscene
index f370a795b..b992805d1 100644
--- a/fixtures/scenes/ysort.esscene
+++ b/fixtures/scenes/ysort.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "YSort",
"entities": [
{
diff --git a/pipeline/src/project/targetSupport.ts b/pipeline/src/project/targetSupport.ts
index 2f02f4cb4..1ce3641d3 100644
--- a/pipeline/src/project/targetSupport.ts
+++ b/pipeline/src/project/targetSupport.ts
@@ -40,9 +40,9 @@ export const SUBSYSTEM_COMPONENTS: Readonly<Record<Subsystem, readonly string[]>
particles: ['ParticleEmitter', 'ParticleForceField'],
postprocess: ['PostProcessVolume'],
physics: [
- 'RigidBody', 'BoxCollider', 'CircleCollider', 'CapsuleCollider', 'SegmentCollider',
- 'PolygonCollider', 'ChainCollider', 'OneWayPlatform', 'CharacterController',
- 'RevoluteJoint', 'DistanceJoint', 'PrismaticJoint', 'WeldJoint', 'WheelJoint', 'MotorJoint',
+ 'RigidBody2D', 'BoxCollider2D', 'CircleCollider2D', 'CapsuleCollider2D', 'SegmentCollider2D',
+ 'PolygonCollider2D', 'ChainCollider2D', 'OneWayPlatform2D', 'CharacterController2D',
+ 'RevoluteJoint2D', 'DistanceJoint2D', 'PrismaticJoint2D', 'WeldJoint2D', 'WheelJoint2D', 'MotorJoint2D',
],
spine: ['SpineAnimation'],
video: ['Video'],
diff --git a/pipeline/tests/export-playable.test.ts b/pipeline/tests/export-playable.test.ts
index 00193dc3b..395b6a33e 100644
--- a/pipeline/tests/export-playable.test.ts
+++ b/pipeline/tests/export-playable.test.ts
@@ -253,9 +253,9 @@ describe('exportGame (playable) — side-module embedding', () => {
function setupRoot(withPhysicsArtifact: boolean): { r: string; o: string } {
const r = mkdtempSync(path.join(tmpdir(), 'estella-playable-phys-'));
mkdirSync(path.join(r, 'scenes'), { recursive: true });
- // A RigidBody makes sceneUsesPhysics() true → the runtime needs physics.
+ // A RigidBody2D makes sceneUsesPhysics() true → the runtime needs physics.
writeFileSync(path.join(r, 'scenes', 'main.esscene'),
- JSON.stringify({ version: '1.0', name: 'Main', entities: [{ id: 0, components: [{ type: 'RigidBody', data: { bodyType: 1 } }] }] }));
+ JSON.stringify({ version: '1.0', name: 'Main', entities: [{ id: 0, components: [{ type: 'RigidBody2D', data: { bodyType: 1 } }] }] }));
writeFileSync(path.join(r, 'scenes', 'main.esscene.meta'), meta(PSCN, 'scene'));
mkdirSync(path.join(r, '_sdk'), { recursive: true });
writeFileSync(path.join(r, '_sdk', 'index.js'),
diff --git a/pipeline/tests/export-side-modules.test.ts b/pipeline/tests/export-side-modules.test.ts
index e09265fc8..733a8df54 100644
--- a/pipeline/tests/export-side-modules.test.ts
+++ b/pipeline/tests/export-side-modules.test.ts
@@ -77,7 +77,7 @@ describe('web package side modules', () => {
}, 60_000);
it('carries the 2D solver for a scene with a body', async () => {
- const f = setup({ version: '1.0', name: 'Main', entities: entities({ type: 'RigidBody', data: { bodyType: 1 } }) });
+ const f = setup({ version: '1.0', name: 'Main', entities: entities({ type: 'RigidBody2D', data: { bodyType: 1 } }) });
try {
expect(shipped((await run(f), f.out))).toEqual(['physics']);
} finally { rmSync(f.root, { recursive: true, force: true }); }
@@ -126,7 +126,7 @@ describe('web package side modules', () => {
mkdirSync(path.join(root, 'prefabs'), { recursive: true });
writeFileSync(path.join(root, 'prefabs', 'enemy.esprefab'), JSON.stringify({
version: '1.0', name: 'Enemy', rootEntityId: 'r',
- entities: [{ prefabEntityId: 'r', name: 'Enemy', parent: null, children: [], visible: true, components: [{ type: 'RigidBody', data: { bodyType: 1 } }] }],
+ entities: [{ prefabEntityId: 'r', name: 'Enemy', parent: null, children: [], visible: true, components: [{ type: 'RigidBody2D', data: { bodyType: 1 } }] }],
}));
writeFileSync(path.join(root, 'prefabs', 'enemy.esprefab.meta'), meta(PFB, 'prefab'));
},
diff --git a/pipeline/tests/target-support.test.ts b/pipeline/tests/target-support.test.ts
index a13a5bd3e..677db633e 100644
--- a/pipeline/tests/target-support.test.ts
+++ b/pipeline/tests/target-support.test.ts
@@ -38,7 +38,7 @@ describe('collectSubsystems', () => {
});
it('sees a prefab body and its physics vocabulary', () => {
- const prefab = { version: '1.0', root: { components: [{ type: 'RigidBody' }, { type: 'BoxCollider' }] } };
+ const prefab = { version: '1.0', root: { components: [{ type: 'RigidBody2D' }, { type: 'BoxCollider2D' }] } };
expect([...collectSubsystems(prefab)]).toEqual(['physics']);
});
@@ -119,7 +119,7 @@ describe('exportGame warns about content the target cannot render', () => {
{ id: 1, components: [{ type: 'Text', data: { text: 'score' } }] },
{ id: 2, components: [{ type: 'ParticleEmitter', data: {} }] },
{ id: 3, components: [{ type: 'TilemapLayer', data: {} }] },
- { id: 4, components: [{ type: 'RigidBody', data: {} }] },
+ { id: 4, components: [{ type: 'RigidBody2D', data: {} }] },
{ id: 5, components: [{ type: 'SpineAnimation', data: {} }] },
],
}));
diff --git a/sdk/benchmarks/physics.bench.ts b/sdk/benchmarks/physics.bench.ts
index de43b1e0a..a330fdd4c 100644
--- a/sdk/benchmarks/physics.bench.ts
+++ b/sdk/benchmarks/physics.bench.ts
@@ -27,7 +27,7 @@ const Transform = defineBuiltin('Transform', {
worldScale: { x: 1, y: 1, z: 1 },
});
-const RigidBody = defineBuiltin('RigidBody', {
+const RigidBody2D = defineBuiltin('RigidBody2D', {
bodyType: 2, gravityScale: 1, linearDamping: 0, angularDamping: 0,
fixedRotation: false, bullet: false, enabled: true,
});
@@ -288,17 +288,17 @@ describe('Physics - addTransform writeback (embind vs ptr)', () => {
// =============================================================================
describe('Physics - entity sync query', () => {
- bench('getEntitiesWithComponents([RigidBody, Transform]) x10 (200 entities)', () => {
+ bench('getEntitiesWithComponents([RigidBody2D, Transform]) x10 (200 entities)', () => {
const world = new World();
const reg = new wasmModule.Registry();
world.connectCpp(reg as unknown as CppRegistry, wasmModule);
for (let i = 0; i < 200; i++) {
const e = world.spawn();
world.insert(e, Transform, TRANSFORM_DATA as any);
- world.insert(e, RigidBody, RIGIDBODY_DATA as any);
+ world.insert(e, RigidBody2D, RIGIDBODY_DATA as any);
}
for (let i = 0; i < 10; i++) {
- world.getEntitiesWithComponents([RigidBody, Transform]);
+ world.getEntitiesWithComponents([RigidBody2D, Transform]);
}
reg.delete();
});
diff --git a/sdk/benchmarks/wasm-vs-world.bench.ts b/sdk/benchmarks/wasm-vs-world.bench.ts
index 604ed86ca..5c92df0ab 100644
--- a/sdk/benchmarks/wasm-vs-world.bench.ts
+++ b/sdk/benchmarks/wasm-vs-world.bench.ts
@@ -3,7 +3,7 @@
import { describe, bench, beforeAll } from 'vitest';
import { World } from '../src/ecs/world';
import { defineComponent, Transform, Sprite, Camera } from '../src/ecs/component';
-import { RigidBody, BoxCollider, CircleCollider } from '../src/physics/PhysicsComponents';
+import { RigidBody2D, BoxCollider2D, CircleCollider2D } from '../src/physics/PhysicsComponents';
import { wasmData } from '../tests/helpers/wasmComponentData';
import type { CppRegistry, ESEngineModule } from '../src/wasm';
import { loadWasmModule } from '../tests/helpers/loadWasm';
@@ -23,9 +23,9 @@ const SPRITE_SDK = sdkData(Sprite);
const TRANSFORM_DATA = wasmData(Transform);
const SPRITE_DATA = wasmData(Sprite);
const CAMERA_DATA = wasmData(Camera);
-const RIGIDBODY_DATA = wasmData(RigidBody);
-const BOXCOLLIDER_DATA = wasmData(BoxCollider);
-const CIRCLECOLLIDER_DATA = wasmData(CircleCollider);
+const RIGIDBODY_DATA = wasmData(RigidBody2D);
+const BOXCOLLIDER_DATA = wasmData(BoxCollider2D);
+const CIRCLECOLLIDER_DATA = wasmData(CircleCollider2D);
const Velocity = defineComponent('BenchVelocity', {
linear: { x: 0, y: 0, z: 0 },
@@ -305,7 +305,7 @@ describe('Ptr-based getter vs embind - Camera', () => {
});
});
-describe('Ptr-based getter vs embind - RigidBody', () => {
+describe('Ptr-based getter vs embind - RigidBody2D', () => {
bench('embind: getRigidBody x100', () => {
const reg = new wasmModule.Registry();
const e = reg.create();
@@ -314,19 +314,19 @@ describe('Ptr-based getter vs embind - RigidBody', () => {
reg.delete();
});
- bench('ptr-based: resolveGetter(RigidBody) x100', () => {
+ bench('ptr-based: resolveGetter(RigidBody2D) x100', () => {
const world = new World();
const reg = new wasmModule.Registry();
world.connectCpp(reg as unknown as CppRegistry, wasmModule);
const e = world.spawn();
- world.insert(e, RigidBody, RIGIDBODY_DATA as any);
- const getter = world.resolveGetter(RigidBody)!;
+ world.insert(e, RigidBody2D, RIGIDBODY_DATA as any);
+ const getter = world.resolveGetter(RigidBody2D)!;
for (let i = 0; i < 100; i++) getter(e);
reg.delete();
});
});
-describe('Ptr-based getter vs embind - BoxCollider', () => {
+describe('Ptr-based getter vs embind - BoxCollider2D', () => {
bench('embind: getBoxCollider x100', () => {
const reg = new wasmModule.Registry();
const e = reg.create();
@@ -335,19 +335,19 @@ describe('Ptr-based getter vs embind - BoxCollider', () => {
reg.delete();
});
- bench('ptr-based: resolveGetter(BoxCollider) x100', () => {
+ bench('ptr-based: resolveGetter(BoxCollider2D) x100', () => {
const world = new World();
const reg = new wasmModule.Registry();
world.connectCpp(reg as unknown as CppRegistry, wasmModule);
const e = world.spawn();
- world.insert(e, BoxCollider, BOXCOLLIDER_DATA as any);
- const getter = world.resolveGetter(BoxCollider)!;
+ world.insert(e, BoxCollider2D, BOXCOLLIDER_DATA as any);
+ const getter = world.resolveGetter(BoxCollider2D)!;
for (let i = 0; i < 100; i++) getter(e);
reg.delete();
});
});
-describe('Ptr-based getter vs embind - CircleCollider', () => {
+describe('Ptr-based getter vs embind - CircleCollider2D', () => {
bench('embind: getCircleCollider x100', () => {
const reg = new wasmModule.Registry();
const e = reg.create();
@@ -356,13 +356,13 @@ describe('Ptr-based getter vs embind - CircleCollider', () => {
reg.delete();
});
- bench('ptr-based: resolveGetter(CircleCollider) x100', () => {
+ bench('ptr-based: resolveGetter(CircleCollider2D) x100', () => {
const world = new World();
const reg = new wasmModule.Registry();
world.connectCpp(reg as unknown as CppRegistry, wasmModule);
const e = world.spawn();
- world.insert(e, CircleCollider, CIRCLECOLLIDER_DATA as any);
- const getter = world.resolveGetter(CircleCollider)!;
+ world.insert(e, CircleCollider2D, CIRCLECOLLIDER_DATA as any);
+ const getter = world.resolveGetter(CircleCollider2D)!;
for (let i = 0; i < 100; i++) getter(e);
reg.delete();
});
@@ -435,7 +435,7 @@ describe('Ptr-based setter vs embind - Velocity write', () => {
});
});
-describe('Ptr-based setter vs embind - RigidBody write', () => {
+describe('Ptr-based setter vs embind - RigidBody2D write', () => {
bench('embind: addRigidBody (set) x100', () => {
const reg = new wasmModule.Registry();
const e = reg.create();
@@ -444,13 +444,13 @@ describe('Ptr-based setter vs embind - RigidBody write', () => {
reg.delete();
});
- bench('ptr-based: resolveSetter(RigidBody) x100', () => {
+ bench('ptr-based: resolveSetter(RigidBody2D) x100', () => {
const world = new World();
const reg = new wasmModule.Registry();
world.connectCpp(reg as unknown as CppRegistry, wasmModule);
const e = world.spawn();
- world.insert(e, RigidBody, RIGIDBODY_DATA as any);
- const setter = world.resolveSetter(RigidBody)!;
+ world.insert(e, RigidBody2D, RIGIDBODY_DATA as any);
+ const setter = world.resolveSetter(RigidBody2D)!;
for (let i = 0; i < 100; i++) setter(e, RIGIDBODY_DATA);
reg.delete();
});
diff --git a/sdk/etc/index.api.md b/sdk/etc/index.api.md
index 0b3dbf04b..6ea1f5f82 100644
--- a/sdk/etc/index.api.md
+++ b/sdk/etc/index.api.md
@@ -5,7 +5,7 @@ Symbols: 113 public · 66 beta · 1507 experimental · 3 deprecated
## ABI_LAYOUT_HASH — const @experimental
```
-"f4ba1e6b5d361dee"
+"70afde061183c505"
```
## ANCHOR_AXES — const @experimental
@@ -1246,9 +1246,23 @@ Kinematic = 1
Static = 0
```
-## BoxCollider — const @experimental
+## BoxCollider2D — const @experimental
```
-BuiltinComponentDef<BoxColliderData>
+BuiltinComponentDef<BoxCollider2DData>
+```
+
+## BoxCollider2DData — interface @experimental
+```
+categoryBits: number
+density: number
+enabled: boolean
+friction: number
+halfExtents: Vec2
+isSensor: boolean
+maskBits: number
+offset: Vec2
+radius: number
+restitution: number
```
## BoxCollider3D — const @experimental
@@ -1265,20 +1279,6 @@ isSensor: boolean
restitution: number
```
-## BoxColliderData — interface @experimental
-```
-categoryBits: number
-density: number
-enabled: boolean
-friction: number
-halfExtents: Vec2
-isSensor: boolean
-maskBits: number
-offset: Vec2
-radius: number
-restitution: number
-```
-
## BtDefinition — interface @experimental
```
orphans: BtNode[] | undefined
@@ -1676,36 +1676,36 @@ update: () => void
width: number
```
-## CapsuleCollider — const @experimental
-```
-BuiltinComponentDef<CapsuleColliderData>
-```
-
-## CapsuleCollider3D — const @experimental
+## CapsuleCollider2D — const @experimental
```
-BuiltinComponentDef<CapsuleCollider3DData>
+BuiltinComponentDef<CapsuleCollider2DData>
```
-## CapsuleCollider3DData — interface @experimental
+## CapsuleCollider2DData — interface @experimental
```
+categoryBits: number
+density: number
enabled: boolean
friction: number
halfHeight: number
isSensor: boolean
+maskBits: number
+offset: Vec2
radius: number
restitution: number
```
-## CapsuleColliderData — interface @experimental
+## CapsuleCollider3D — const @experimental
+```
+BuiltinComponentDef<CapsuleCollider3DData>
+```
+
+## CapsuleCollider3DData — interface @experimental
```
-categoryBits: number
-density: number
enabled: boolean
friction: number
halfHeight: number
isSensor: boolean
-maskBits: number
-offset: Vec2
radius: number
restitution: number
```
@@ -1872,9 +1872,9 @@ tier: CensusTier
unit: "count" | "bytes"
```
-## ChainCollider — const @experimental
+## ChainCollider2D — const @experimental
```
-ComponentDef<ChainColliderData>
+ComponentDef<ChainCollider2DData>
```
## Changed — function @experimental
@@ -1888,9 +1888,26 @@ ComponentDef<ChainColliderData>
@internal _filterType: "changed"
```
-## CharacterController — const @beta
+## CharacterController2D — const @beta
```
-ComponentDef<CharacterControllerData>
+ComponentDef<CharacterController2DData>
+```
+
+## CharacterController2DData — interface @experimental
+```
+floorMaxAngle: number
+floorNormal: Vec2
+isOnCeiling: boolean
+isOnFloor: boolean
+isOnWall: boolean
+maskBits: number
+maxSlides: number
+realVelocity: Vec2
+skinWidth: number
+slideOnCeiling: boolean
+snapLength: number
+up: Vec2
+velocity: Vec2
```
## CharacterController3D — const @beta
@@ -1915,23 +1932,6 @@ stepHeight: number
velocity: Vec3
```
-## CharacterControllerData — interface @experimental
-```
-floorMaxAngle: number
-floorNormal: Vec2
-isOnCeiling: boolean
-isOnFloor: boolean
-isOnWall: boolean
-maskBits: number
-maxSlides: number
-realVelocity: Vec2
-skinWidth: number
-slideOnCeiling: boolean
-snapLength: number
-up: Vec2
-velocity: Vec2
-```
-
## Children — const @public
```
BuiltinComponentDef<ChildrenData>
@@ -1942,12 +1942,12 @@ BuiltinComponentDef<ChildrenData>
entities: number[]
```
-## CircleCollider — const @experimental
+## CircleCollider2D — const @experimental
```
-BuiltinComponentDef<CircleColliderData>
+BuiltinComponentDef<CircleCollider2DData>
```
-## CircleColliderData — interface @experimental
+## CircleCollider2DData — interface @experimental
```
categoryBits: number
density: number
@@ -2540,9 +2540,9 @@ value: number
ComponentDef<{}>
```
-## DistanceJoint — const @experimental
+## DistanceJoint2D — const @experimental
```
-ComponentDef<DistanceJointData>
+ComponentDef<DistanceJoint2DData>
```
## DistanceJoint3D — const @beta
@@ -4638,9 +4638,9 @@ meta: boolean
shift: boolean
```
-## MotorJoint — const @experimental
+## MotorJoint2D — const @experimental
```
-ComponentDef<MotorJointData>
+ComponentDef<MotorJoint2DData>
```
## MouseButton — const @public
@@ -5003,9 +5003,9 @@ params: NodeParamSpec[]
(filter: FilterExpr): FilterExpr
```
-## OneWayPlatform — const @experimental
+## OneWayPlatform2D — const @experimental
```
-ComponentDef<OneWayPlatformData>
+ComponentDef<OneWayPlatform2DData>
```
## Or — function @experimental
@@ -5758,9 +5758,9 @@ connectedEntity: number
enabled: boolean
```
-## PolygonCollider — const @experimental
+## PolygonCollider2D — const @experimental
```
-ComponentDef<PolygonColliderData>
+ComponentDef<PolygonCollider2DData>
```
## PooledAudioNode — interface @experimental
@@ -5972,9 +5972,9 @@ static new (): PrefabsPlugin
static prototype: PrefabsPlugin
```
-## PrismaticJoint — const @experimental
+## PrismaticJoint2D — const @experimental
```
-ComponentDef<PrismaticJointData>
+ComponentDef<PrismaticJoint2DData>
```
## ProbedRegistrations — interface @experimental
@@ -6485,9 +6485,9 @@ type: "reverb"
wet: number | undefined
```
-## RevoluteJoint — const @experimental
+## RevoluteJoint2D — const @experimental
```
-ComponentDef<RevoluteJointData>
+ComponentDef<RevoluteJoint2DData>
```
## RichTextRun — type @experimental
@@ -6495,36 +6495,36 @@ ComponentDef<RevoluteJointData>
TextSegment | ImageSegment
```
-## RigidBody — const @experimental
-```
-BuiltinComponentDef<RigidBodyData>
-```
-
-## RigidBody3D — const @experimental
+## RigidBody2D — const @experimental
```
-BuiltinComponentDef<RigidBody3DData>
+BuiltinComponentDef<RigidBody2DData>
```
-## RigidBody3DData — interface @experimental
+## RigidBody2DData — interface @experimental
```
angularDamping: number
bodyType: number
-continuousCollision: boolean
+bullet: boolean
enabled: boolean
fixedRotation: boolean
gravityScale: number
-layer: number
linearDamping: number
```
-## RigidBodyData — interface @experimental
+## RigidBody3D — const @experimental
+```
+BuiltinComponentDef<RigidBody3DData>
+```
+
+## RigidBody3DData — interface @experimental
```
angularDamping: number
bodyType: number
-bullet: boolean
+continuousCollision: boolean
enabled: boolean
fixedRotation: boolean
gravityScale: number
+layer: number
linearDamping: number
```
@@ -6594,7 +6594,7 @@ ComponentDef<{}>
## SCENE_FORMAT_VERSION — const @experimental
```
-2
+3
```
## SCREEN_FIT_OFF — const @experimental
@@ -7019,9 +7019,9 @@ wheelSpeed: number | undefined
world: World
```
-## SegmentCollider — const @experimental
+## SegmentCollider2D — const @experimental
```
-BuiltinComponentDef<SegmentColliderData>
+BuiltinComponentDef<SegmentCollider2DData>
```
## SenseResult — interface @experimental
@@ -9206,14 +9206,14 @@ device: unknown
reason: string | undefined
```
-## WeldJoint — const @experimental
+## WeldJoint2D — const @experimental
```
-ComponentDef<WeldJointData>
+ComponentDef<WeldJoint2DData>
```
-## WheelJoint — const @experimental
+## WheelJoint2D — const @experimental
```
-ComponentDef<WheelJointData>
+ComponentDef<WheelJoint2DData>
```
## WidgetInteractionInit — interface @experimental
diff --git a/sdk/etc/index.native.api.md b/sdk/etc/index.native.api.md
index 8956f141f..668fe1ba3 100644
--- a/sdk/etc/index.native.api.md
+++ b/sdk/etc/index.native.api.md
@@ -5,7 +5,7 @@ Symbols: 113 public · 71 beta · 1526 experimental · 3 deprecated
## ABI_LAYOUT_HASH — const @experimental
```
-"f4ba1e6b5d361dee"
+"70afde061183c505"
```
## ANCHOR_AXES — const @experimental
@@ -1246,9 +1246,23 @@ Kinematic = 1
Static = 0
```
-## BoxCollider — const @experimental
+## BoxCollider2D — const @experimental
```
-BuiltinComponentDef<BoxColliderData>
+BuiltinComponentDef<BoxCollider2DData>
+```
+
+## BoxCollider2DData — interface @experimental
+```
+categoryBits: number
+density: number
+enabled: boolean
+friction: number
+halfExtents: Vec2
+isSensor: boolean
+maskBits: number
+offset: Vec2
+radius: number
+restitution: number
```
## BoxCollider3D — const @experimental
@@ -1265,20 +1279,6 @@ isSensor: boolean
restitution: number
```
-## BoxColliderData — interface @experimental
-```
-categoryBits: number
-density: number
-enabled: boolean
-friction: number
-halfExtents: Vec2
-isSensor: boolean
-maskBits: number
-offset: Vec2
-radius: number
-restitution: number
-```
-
## BtDefinition — interface @experimental
```
orphans: BtNode[] | undefined
@@ -1676,36 +1676,36 @@ update: () => void
width: number
```
-## CapsuleCollider — const @experimental
-```
-BuiltinComponentDef<CapsuleColliderData>
-```
-
-## CapsuleCollider3D — const @experimental
+## CapsuleCollider2D — const @experimental
```
-BuiltinComponentDef<CapsuleCollider3DData>
+BuiltinComponentDef<CapsuleCollider2DData>
```
-## CapsuleCollider3DData — interface @experimental
+## CapsuleCollider2DData — interface @experimental
```
+categoryBits: number
+density: number
enabled: boolean
friction: number
halfHeight: number
isSensor: boolean
+maskBits: number
+offset: Vec2
radius: number
restitution: number
```
-## CapsuleColliderData — interface @experimental
+## CapsuleCollider3D — const @experimental
+```
+BuiltinComponentDef<CapsuleCollider3DData>
+```
+
+## CapsuleCollider3DData — interface @experimental
```
-categoryBits: number
-density: number
enabled: boolean
friction: number
halfHeight: number
isSensor: boolean
-maskBits: number
-offset: Vec2
radius: number
restitution: number
```
@@ -1872,9 +1872,9 @@ tier: CensusTier
unit: "count" | "bytes"
```
-## ChainCollider — const @experimental
+## ChainCollider2D — const @experimental
```
-ComponentDef<ChainColliderData>
+ComponentDef<ChainCollider2DData>
```
## Changed — function @experimental
@@ -1888,9 +1888,26 @@ ComponentDef<ChainColliderData>
@internal _filterType: "changed"
```
-## CharacterController — const @beta
+## CharacterController2D — const @beta
```
-ComponentDef<CharacterControllerData>
+ComponentDef<CharacterController2DData>
+```
+
+## CharacterController2DData — interface @experimental
+```
+floorMaxAngle: number
+floorNormal: Vec2
+isOnCeiling: boolean
+isOnFloor: boolean
+isOnWall: boolean
+maskBits: number
+maxSlides: number
+realVelocity: Vec2
+skinWidth: number
+slideOnCeiling: boolean
+snapLength: number
+up: Vec2
+velocity: Vec2
```
## CharacterController3D — const @beta
@@ -1915,23 +1932,6 @@ stepHeight: number
velocity: Vec3
```
-## CharacterControllerData — interface @experimental
-```
-floorMaxAngle: number
-floorNormal: Vec2
-isOnCeiling: boolean
-isOnFloor: boolean
-isOnWall: boolean
-maskBits: number
-maxSlides: number
-realVelocity: Vec2
-skinWidth: number
-slideOnCeiling: boolean
-snapLength: number
-up: Vec2
-velocity: Vec2
-```
-
## Children — const @public
```
BuiltinComponentDef<ChildrenData>
@@ -1942,12 +1942,12 @@ BuiltinComponentDef<ChildrenData>
entities: number[]
```
-## CircleCollider — const @experimental
+## CircleCollider2D — const @experimental
```
-BuiltinComponentDef<CircleColliderData>
+BuiltinComponentDef<CircleCollider2DData>
```
-## CircleColliderData — interface @experimental
+## CircleCollider2DData — interface @experimental
```
categoryBits: number
density: number
@@ -2548,9 +2548,9 @@ value: number
ComponentDef<{}>
```
-## DistanceJoint — const @experimental
+## DistanceJoint2D — const @experimental
```
-ComponentDef<DistanceJointData>
+ComponentDef<DistanceJoint2DData>
```
## DistanceJoint3D — const @beta
@@ -4651,9 +4651,9 @@ meta: boolean
shift: boolean
```
-## MotorJoint — const @experimental
+## MotorJoint2D — const @experimental
```
-ComponentDef<MotorJointData>
+ComponentDef<MotorJoint2DData>
```
## MouseButton — const @public
@@ -5181,9 +5181,9 @@ params: NodeParamSpec[]
(filter: FilterExpr): FilterExpr
```
-## OneWayPlatform — const @experimental
+## OneWayPlatform2D — const @experimental
```
-ComponentDef<OneWayPlatformData>
+ComponentDef<OneWayPlatform2DData>
```
## Or — function @experimental
@@ -5941,9 +5941,9 @@ connectedEntity: number
enabled: boolean
```
-## PolygonCollider — const @experimental
+## PolygonCollider2D — const @experimental
```
-ComponentDef<PolygonColliderData>
+ComponentDef<PolygonCollider2DData>
```
## PooledAudioNode — interface @experimental
@@ -6155,9 +6155,9 @@ static new (): PrefabsPlugin
static prototype: PrefabsPlugin
```
-## PrismaticJoint — const @experimental
+## PrismaticJoint2D — const @experimental
```
-ComponentDef<PrismaticJointData>
+ComponentDef<PrismaticJoint2DData>
```
## ProbedRegistrations — interface @experimental
@@ -6678,9 +6678,9 @@ type: "reverb"
wet: number | undefined
```
-## RevoluteJoint — const @experimental
+## RevoluteJoint2D — const @experimental
```
-ComponentDef<RevoluteJointData>
+ComponentDef<RevoluteJoint2DData>
```
## RichTextRun — type @experimental
@@ -6688,36 +6688,36 @@ ComponentDef<RevoluteJointData>
TextSegment | ImageSegment
```
-## RigidBody — const @experimental
-```
-BuiltinComponentDef<RigidBodyData>
-```
-
-## RigidBody3D — const @experimental
+## RigidBody2D — const @experimental
```
-BuiltinComponentDef<RigidBody3DData>
+BuiltinComponentDef<RigidBody2DData>
```
-## RigidBody3DData — interface @experimental
+## RigidBody2DData — interface @experimental
```
angularDamping: number
bodyType: number
-continuousCollision: boolean
+bullet: boolean
enabled: boolean
fixedRotation: boolean
gravityScale: number
-layer: number
linearDamping: number
```
-## RigidBodyData — interface @experimental
+## RigidBody3D — const @experimental
+```
+BuiltinComponentDef<RigidBody3DData>
+```
+
+## RigidBody3DData — interface @experimental
```
angularDamping: number
bodyType: number
-bullet: boolean
+continuousCollision: boolean
enabled: boolean
fixedRotation: boolean
gravityScale: number
+layer: number
linearDamping: number
```
@@ -6787,7 +6787,7 @@ ComponentDef<{}>
## SCENE_FORMAT_VERSION — const @experimental
```
-2
+3
```
## SCREEN_FIT_OFF — const @experimental
@@ -7212,9 +7212,9 @@ wheelSpeed: number | undefined
world: World
```
-## SegmentCollider — const @experimental
+## SegmentCollider2D — const @experimental
```
-BuiltinComponentDef<SegmentColliderData>
+BuiltinComponentDef<SegmentCollider2DData>
```
## SenseResult — interface @experimental
@@ -9399,14 +9399,14 @@ device: unknown
reason: string | undefined
```
-## WeldJoint — const @experimental
+## WeldJoint2D — const @experimental
```
-ComponentDef<WeldJointData>
+ComponentDef<WeldJoint2DData>
```
-## WheelJoint — const @experimental
+## WheelJoint2D — const @experimental
```
-ComponentDef<WheelJointData>
+ComponentDef<WheelJoint2DData>
```
## WidgetInteractionInit — interface @experimental
diff --git a/sdk/etc/index.node.api.md b/sdk/etc/index.node.api.md
index 3d8824cbc..335b7f87d 100644
--- a/sdk/etc/index.node.api.md
+++ b/sdk/etc/index.node.api.md
@@ -1241,9 +1241,23 @@ Kinematic = 1
Static = 0
```
-## BoxCollider — const @experimental
+## BoxCollider2D — const @experimental
```
-BuiltinComponentDef<BoxColliderData>
+BuiltinComponentDef<BoxCollider2DData>
+```
+
+## BoxCollider2DData — interface @experimental
+```
+categoryBits: number
+density: number
+enabled: boolean
+friction: number
+halfExtents: Vec2
+isSensor: boolean
+maskBits: number
+offset: Vec2
+radius: number
+restitution: number
```
## BoxCollider3D — const @experimental
@@ -1260,20 +1274,6 @@ isSensor: boolean
restitution: number
```
-## BoxColliderData — interface @experimental
-```
-categoryBits: number
-density: number
-enabled: boolean
-friction: number
-halfExtents: Vec2
-isSensor: boolean
-maskBits: number
-offset: Vec2
-radius: number
-restitution: number
-```
-
## BtDefinition — interface @experimental
```
orphans: BtNode[] | undefined
@@ -1671,36 +1671,36 @@ update: () => void
width: number
```
-## CapsuleCollider — const @experimental
-```
-BuiltinComponentDef<CapsuleColliderData>
-```
-
-## CapsuleCollider3D — const @experimental
+## CapsuleCollider2D — const @experimental
```
-BuiltinComponentDef<CapsuleCollider3DData>
+BuiltinComponentDef<CapsuleCollider2DData>
```
-## CapsuleCollider3DData — interface @experimental
+## CapsuleCollider2DData — interface @experimental
```
+categoryBits: number
+density: number
enabled: boolean
friction: number
halfHeight: number
isSensor: boolean
+maskBits: number
+offset: Vec2
radius: number
restitution: number
```
-## CapsuleColliderData — interface @experimental
+## CapsuleCollider3D — const @experimental
+```
+BuiltinComponentDef<CapsuleCollider3DData>
+```
+
+## CapsuleCollider3DData — interface @experimental
```
-categoryBits: number
-density: number
enabled: boolean
friction: number
halfHeight: number
isSensor: boolean
-maskBits: number
-offset: Vec2
radius: number
restitution: number
```
@@ -1867,9 +1867,9 @@ tier: CensusTier
unit: "count" | "bytes"
```
-## ChainCollider — const @experimental
+## ChainCollider2D — const @experimental
```
-ComponentDef<ChainColliderData>
+ComponentDef<ChainCollider2DData>
```
## Changed — function @experimental
@@ -1883,9 +1883,26 @@ ComponentDef<ChainColliderData>
@internal _filterType: "changed"
```
-## CharacterController — const @beta
+## CharacterController2D — const @beta
```
-ComponentDef<CharacterControllerData>
+ComponentDef<CharacterController2DData>
+```
+
+## CharacterController2DData — interface @experimental
+```
+floorMaxAngle: number
+floorNormal: Vec2
+isOnCeiling: boolean
+isOnFloor: boolean
+isOnWall: boolean
+maskBits: number
+maxSlides: number
+realVelocity: Vec2
+skinWidth: number
+slideOnCeiling: boolean
+snapLength: number
+up: Vec2
+velocity: Vec2
```
## CharacterController3D — const @beta
@@ -1910,23 +1927,6 @@ stepHeight: number
velocity: Vec3
```
-## CharacterControllerData — interface @experimental
-```
-floorMaxAngle: number
-floorNormal: Vec2
-isOnCeiling: boolean
-isOnFloor: boolean
-isOnWall: boolean
-maskBits: number
-maxSlides: number
-realVelocity: Vec2
-skinWidth: number
-slideOnCeiling: boolean
-snapLength: number
-up: Vec2
-velocity: Vec2
-```
-
## Children — const @public
```
BuiltinComponentDef<ChildrenData>
@@ -1937,12 +1937,12 @@ BuiltinComponentDef<ChildrenData>
entities: number[]
```
-## CircleCollider — const @experimental
+## CircleCollider2D — const @experimental
```
-BuiltinComponentDef<CircleColliderData>
+BuiltinComponentDef<CircleCollider2DData>
```
-## CircleColliderData — interface @experimental
+## CircleCollider2DData — interface @experimental
```
categoryBits: number
density: number
@@ -2535,9 +2535,9 @@ value: number
ComponentDef<{}>
```
-## DistanceJoint — const @experimental
+## DistanceJoint2D — const @experimental
```
-ComponentDef<DistanceJointData>
+ComponentDef<DistanceJoint2DData>
```
## DistanceJoint3D — const @beta
@@ -4633,9 +4633,9 @@ meta: boolean
shift: boolean
```
-## MotorJoint — const @experimental
+## MotorJoint2D — const @experimental
```
-ComponentDef<MotorJointData>
+ComponentDef<MotorJoint2DData>
```
## MouseButton — const @public
@@ -4998,9 +4998,9 @@ params: NodeParamSpec[]
(filter: FilterExpr): FilterExpr
```
-## OneWayPlatform — const @experimental
+## OneWayPlatform2D — const @experimental
```
-ComponentDef<OneWayPlatformData>
+ComponentDef<OneWayPlatform2DData>
```
## Or — function @experimental
@@ -5753,9 +5753,9 @@ connectedEntity: number
enabled: boolean
```
-## PolygonCollider — const @experimental
+## PolygonCollider2D — const @experimental
```
-ComponentDef<PolygonColliderData>
+ComponentDef<PolygonCollider2DData>
```
## PooledAudioNode — interface @experimental
@@ -5967,9 +5967,9 @@ static new (): PrefabsPlugin
static prototype: PrefabsPlugin
```
-## PrismaticJoint — const @experimental
+## PrismaticJoint2D — const @experimental
```
-ComponentDef<PrismaticJointData>
+ComponentDef<PrismaticJoint2DData>
```
## ProbedRegistrations — interface @experimental
@@ -6480,9 +6480,9 @@ type: "reverb"
wet: number | undefined
```
-## RevoluteJoint — const @experimental
+## RevoluteJoint2D — const @experimental
```
-ComponentDef<RevoluteJointData>
+ComponentDef<RevoluteJoint2DData>
```
## RichTextRun — type @experimental
@@ -6490,36 +6490,36 @@ ComponentDef<RevoluteJointData>
TextSegment | ImageSegment
```
-## RigidBody — const @experimental
-```
-BuiltinComponentDef<RigidBodyData>
-```
-
-## RigidBody3D — const @experimental
+## RigidBody2D — const @experimental
```
-BuiltinComponentDef<RigidBody3DData>
+BuiltinComponentDef<RigidBody2DData>
```
-## RigidBody3DData — interface @experimental
+## RigidBody2DData — interface @experimental
```
angularDamping: number
bodyType: number
-continuousCollision: boolean
+bullet: boolean
enabled: boolean
fixedRotation: boolean
gravityScale: number
-layer: number
linearDamping: number
```
-## RigidBodyData — interface @experimental
+## RigidBody3D — const @experimental
+```
+BuiltinComponentDef<RigidBody3DData>
+```
+
+## RigidBody3DData — interface @experimental
```
angularDamping: number
bodyType: number
-bullet: boolean
+continuousCollision: boolean
enabled: boolean
fixedRotation: boolean
gravityScale: number
+layer: number
linearDamping: number
```
@@ -6589,7 +6589,7 @@ ComponentDef<{}>
## SCENE_FORMAT_VERSION — const @experimental
```
-2
+3
```
## SCREEN_FIT_OFF — const @experimental
@@ -7014,9 +7014,9 @@ wheelSpeed: number | undefined
world: World
```
-## SegmentCollider — const @experimental
+## SegmentCollider2D — const @experimental
```
-BuiltinComponentDef<SegmentColliderData>
+BuiltinComponentDef<SegmentCollider2DData>
```
## SenseResult — interface @experimental
@@ -9201,14 +9201,14 @@ device: unknown
reason: string | undefined
```
-## WeldJoint — const @experimental
+## WeldJoint2D — const @experimental
```
-ComponentDef<WeldJointData>
+ComponentDef<WeldJoint2DData>
```
-## WheelJoint — const @experimental
+## WheelJoint2D — const @experimental
```
-ComponentDef<WheelJointData>
+ComponentDef<WheelJoint2DData>
```
## WidgetInteractionInit — interface @experimental
diff --git a/sdk/etc/minigame.api.md b/sdk/etc/minigame.api.md
index 179cf5c80..c7d2a49f3 100644
--- a/sdk/etc/minigame.api.md
+++ b/sdk/etc/minigame.api.md
@@ -1241,9 +1241,23 @@ Kinematic = 1
Static = 0
```
-## BoxCollider — const @experimental
+## BoxCollider2D — const @experimental
```
-BuiltinComponentDef<BoxColliderData>
+BuiltinComponentDef<BoxCollider2DData>
+```
+
+## BoxCollider2DData — interface @experimental
+```
+categoryBits: number
+density: number
+enabled: boolean
+friction: number
+halfExtents: Vec2
+isSensor: boolean
+maskBits: number
+offset: Vec2
+radius: number
+restitution: number
```
## BoxCollider3D — const @experimental
@@ -1260,20 +1274,6 @@ isSensor: boolean
restitution: number
```
-## BoxColliderData — interface @experimental
-```
-categoryBits: number
-density: number
-enabled: boolean
-friction: number
-halfExtents: Vec2
-isSensor: boolean
-maskBits: number
-offset: Vec2
-radius: number
-restitution: number
-```
-
## BtDefinition — interface @experimental
```
orphans: BtNode[] | undefined
@@ -1671,36 +1671,36 @@ update: () => void
width: number
```
-## CapsuleCollider — const @experimental
-```
-BuiltinComponentDef<CapsuleColliderData>
-```
-
-## CapsuleCollider3D — const @experimental
+## CapsuleCollider2D — const @experimental
```
-BuiltinComponentDef<CapsuleCollider3DData>
+BuiltinComponentDef<CapsuleCollider2DData>
```
-## CapsuleCollider3DData — interface @experimental
+## CapsuleCollider2DData — interface @experimental
```
+categoryBits: number
+density: number
enabled: boolean
friction: number
halfHeight: number
isSensor: boolean
+maskBits: number
+offset: Vec2
radius: number
restitution: number
```
-## CapsuleColliderData — interface @experimental
+## CapsuleCollider3D — const @experimental
+```
+BuiltinComponentDef<CapsuleCollider3DData>
+```
+
+## CapsuleCollider3DData — interface @experimental
```
-categoryBits: number
-density: number
enabled: boolean
friction: number
halfHeight: number
isSensor: boolean
-maskBits: number
-offset: Vec2
radius: number
restitution: number
```
@@ -1867,9 +1867,9 @@ tier: CensusTier
unit: "count" | "bytes"
```
-## ChainCollider — const @experimental
+## ChainCollider2D — const @experimental
```
-ComponentDef<ChainColliderData>
+ComponentDef<ChainCollider2DData>
```
## Changed — function @experimental
@@ -1883,9 +1883,26 @@ ComponentDef<ChainColliderData>
@internal _filterType: "changed"
```
-## CharacterController — const @beta
+## CharacterController2D — const @beta
```
-ComponentDef<CharacterControllerData>
+ComponentDef<CharacterController2DData>
+```
+
+## CharacterController2DData — interface @experimental
+```
+floorMaxAngle: number
+floorNormal: Vec2
+isOnCeiling: boolean
+isOnFloor: boolean
+isOnWall: boolean
+maskBits: number
+maxSlides: number
+realVelocity: Vec2
+skinWidth: number
+slideOnCeiling: boolean
+snapLength: number
+up: Vec2
+velocity: Vec2
```
## CharacterController3D — const @beta
@@ -1910,23 +1927,6 @@ stepHeight: number
velocity: Vec3
```
-## CharacterControllerData — interface @experimental
-```
-floorMaxAngle: number
-floorNormal: Vec2
-isOnCeiling: boolean
-isOnFloor: boolean
-isOnWall: boolean
-maskBits: number
-maxSlides: number
-realVelocity: Vec2
-skinWidth: number
-slideOnCeiling: boolean
-snapLength: number
-up: Vec2
-velocity: Vec2
-```
-
## Children — const @public
```
BuiltinComponentDef<ChildrenData>
@@ -1937,12 +1937,12 @@ BuiltinComponentDef<ChildrenData>
entities: number[]
```
-## CircleCollider — const @experimental
+## CircleCollider2D — const @experimental
```
-BuiltinComponentDef<CircleColliderData>
+BuiltinComponentDef<CircleCollider2DData>
```
-## CircleColliderData — interface @experimental
+## CircleCollider2DData — interface @experimental
```
categoryBits: number
density: number
@@ -2535,9 +2535,9 @@ value: number
ComponentDef<{}>
```
-## DistanceJoint — const @experimental
+## DistanceJoint2D — const @experimental
```
-ComponentDef<DistanceJointData>
+ComponentDef<DistanceJoint2DData>
```
## DistanceJoint3D — const @beta
@@ -4878,9 +4878,9 @@ meta: boolean
shift: boolean
```
-## MotorJoint — const @experimental
+## MotorJoint2D — const @experimental
```
-ComponentDef<MotorJointData>
+ComponentDef<MotorJoint2DData>
```
## MouseButton — const @public
@@ -5243,9 +5243,9 @@ params: NodeParamSpec[]
(filter: FilterExpr): FilterExpr
```
-## OneWayPlatform — const @experimental
+## OneWayPlatform2D — const @experimental
```
-ComponentDef<OneWayPlatformData>
+ComponentDef<OneWayPlatform2DData>
```
## Or — function @experimental
@@ -5998,9 +5998,9 @@ connectedEntity: number
enabled: boolean
```
-## PolygonCollider — const @experimental
+## PolygonCollider2D — const @experimental
```
-ComponentDef<PolygonColliderData>
+ComponentDef<PolygonCollider2DData>
```
## PooledAudioNode — interface @experimental
@@ -6212,9 +6212,9 @@ static new (): PrefabsPlugin
static prototype: PrefabsPlugin
```
-## PrismaticJoint — const @experimental
+## PrismaticJoint2D — const @experimental
```
-ComponentDef<PrismaticJointData>
+ComponentDef<PrismaticJoint2DData>
```
## ProbedRegistrations — interface @experimental
@@ -6725,9 +6725,9 @@ type: "reverb"
wet: number | undefined
```
-## RevoluteJoint — const @experimental
+## RevoluteJoint2D — const @experimental
```
-ComponentDef<RevoluteJointData>
+ComponentDef<RevoluteJoint2DData>
```
## RichTextRun — type @experimental
@@ -6735,36 +6735,36 @@ ComponentDef<RevoluteJointData>
TextSegment | ImageSegment
```
-## RigidBody — const @experimental
-```
-BuiltinComponentDef<RigidBodyData>
-```
-
-## RigidBody3D — const @experimental
+## RigidBody2D — const @experimental
```
-BuiltinComponentDef<RigidBody3DData>
+BuiltinComponentDef<RigidBody2DData>
```
-## RigidBody3DData — interface @experimental
+## RigidBody2DData — interface @experimental
```
angularDamping: number
bodyType: number
-continuousCollision: boolean
+bullet: boolean
enabled: boolean
fixedRotation: boolean
gravityScale: number
-layer: number
linearDamping: number
```
-## RigidBodyData — interface @experimental
+## RigidBody3D — const @experimental
+```
+BuiltinComponentDef<RigidBody3DData>
+```
+
+## RigidBody3DData — interface @experimental
```
angularDamping: number
bodyType: number
-bullet: boolean
+continuousCollision: boolean
enabled: boolean
fixedRotation: boolean
gravityScale: number
+layer: number
linearDamping: number
```
@@ -6834,7 +6834,7 @@ ComponentDef<{}>
## SCENE_FORMAT_VERSION — const @experimental
```
-2
+3
```
## SCREEN_FIT_OFF — const @experimental
@@ -7259,9 +7259,9 @@ wheelSpeed: number | undefined
world: World
```
-## SegmentCollider — const @experimental
+## SegmentCollider2D — const @experimental
```
-BuiltinComponentDef<SegmentColliderData>
+BuiltinComponentDef<SegmentCollider2DData>
```
## SenseResult — interface @experimental
@@ -9452,14 +9452,14 @@ device: unknown
reason: string | undefined
```
-## WeldJoint — const @experimental
+## WeldJoint2D — const @experimental
```
-ComponentDef<WeldJointData>
+ComponentDef<WeldJoint2DData>
```
-## WheelJoint — const @experimental
+## WheelJoint2D — const @experimental
```
-ComponentDef<WheelJointData>
+ComponentDef<WheelJoint2DData>
```
## WidgetInteractionInit — interface @experimental
diff --git a/sdk/etc/physics.api.md b/sdk/etc/physics.api.md
index 050a653cf..fda6ff673 100644
--- a/sdk/etc/physics.api.md
+++ b/sdk/etc/physics.api.md
@@ -10,12 +10,12 @@ Kinematic = 1
Static = 0
```
-## BoxCollider — const @experimental
+## BoxCollider2D — const @experimental
```
-BuiltinComponentDef<BoxColliderData>
+BuiltinComponentDef<BoxCollider2DData>
```
-## BoxColliderData — interface @experimental
+## BoxCollider2DData — interface @experimental
```
categoryBits: number
density: number
@@ -34,12 +34,12 @@ restitution: number
16
```
-## CapsuleCollider — const @experimental
+## CapsuleCollider2D — const @experimental
```
-BuiltinComponentDef<CapsuleColliderData>
+BuiltinComponentDef<CapsuleCollider2DData>
```
-## CapsuleColliderData — interface @experimental
+## CapsuleCollider2DData — interface @experimental
```
categoryBits: number
density: number
@@ -53,12 +53,12 @@ radius: number
restitution: number
```
-## ChainCollider — const @experimental
+## ChainCollider2D — const @experimental
```
-ComponentDef<ChainColliderData>
+ComponentDef<ChainCollider2DData>
```
-## ChainColliderData — interface @experimental
+## ChainCollider2DData — interface @experimental
```
categoryBits: number
enabled: boolean
@@ -69,12 +69,12 @@ points: Vec2[]
restitution: number
```
-## CharacterController — const @beta
+## CharacterController2D — const @beta
```
-ComponentDef<CharacterControllerData>
+ComponentDef<CharacterController2DData>
```
-## CharacterControllerData — interface @experimental
+## CharacterController2DData — interface @experimental
```
floorMaxAngle: number
floorNormal: Vec2
@@ -91,12 +91,12 @@ up: Vec2
velocity: Vec2
```
-## CircleCollider — const @experimental
+## CircleCollider2D — const @experimental
```
-BuiltinComponentDef<CircleColliderData>
+BuiltinComponentDef<CircleCollider2DData>
```
-## CircleColliderData — interface @experimental
+## CircleCollider2DData — interface @experimental
```
categoryBits: number
density: number
@@ -153,12 +153,12 @@ pointX: number
pointY: number
```
-## DistanceJoint — const @experimental
+## DistanceJoint2D — const @experimental
```
-ComponentDef<DistanceJointData>
+ComponentDef<DistanceJoint2DData>
```
-## DistanceJointData — interface @experimental
+## DistanceJoint2DData — interface @experimental
```
anchorA: Vec2
anchorB: Vec2
@@ -184,12 +184,12 @@ inertia: number
mass: number
```
-## MotorJoint — const @experimental
+## MotorJoint2D — const @experimental
```
-ComponentDef<MotorJointData>
+ComponentDef<MotorJoint2DData>
```
-## MotorJointData — interface @experimental
+## MotorJoint2DData — interface @experimental
```
angularDampingRatio: number
angularHertz: number
@@ -237,12 +237,12 @@ x: number
y: number
```
-## OneWayPlatform — const @experimental
+## OneWayPlatform2D — const @experimental
```
-ComponentDef<OneWayPlatformData>
+ComponentDef<OneWayPlatform2DData>
```
-## OneWayPlatformData — interface @experimental
+## OneWayPlatform2DData — interface @experimental
```
enabled: boolean
normal: Vec2
@@ -521,12 +521,12 @@ _physics_step: (dt: number) => void
_physics_updateBodyProperties: (entityId: number, bodyType: number, gravityScale: number, linearDamping: number, angularDamping: number, fixedRotation: number, bullet: number) => void
```
-## PolygonCollider — const @experimental
+## PolygonCollider2D — const @experimental
```
-ComponentDef<PolygonColliderData>
+ComponentDef<PolygonCollider2DData>
```
-## PolygonColliderData — interface @experimental
+## PolygonCollider2DData — interface @experimental
```
categoryBits: number
density: number
@@ -539,12 +539,12 @@ restitution: number
vertices: Vec2[]
```
-## PrismaticJoint — const @experimental
+## PrismaticJoint2D — const @experimental
```
-ComponentDef<PrismaticJointData>
+ComponentDef<PrismaticJoint2DData>
```
-## PrismaticJointData — interface @experimental
+## PrismaticJoint2DData — interface @experimental
```
anchorA: Vec2
anchorB: Vec2
@@ -571,12 +571,12 @@ normal: Vec2
point: Vec2
```
-## RevoluteJoint — const @experimental
+## RevoluteJoint2D — const @experimental
```
-ComponentDef<RevoluteJointData>
+ComponentDef<RevoluteJoint2DData>
```
-## RevoluteJointData — interface @experimental
+## RevoluteJoint2DData — interface @experimental
```
anchorA: Vec2
anchorB: Vec2
@@ -591,12 +591,12 @@ motorSpeed: number
upperAngle: number
```
-## RigidBody — const @experimental
+## RigidBody2D — const @experimental
```
-BuiltinComponentDef<RigidBodyData>
+BuiltinComponentDef<RigidBody2DData>
```
-## RigidBodyData — interface @experimental
+## RigidBody2DData — interface @experimental
```
angularDamping: number
bodyType: number
@@ -607,12 +607,12 @@ gravityScale: number
linearDamping: number
```
-## SegmentCollider — const @experimental
+## SegmentCollider2D — const @experimental
```
-BuiltinComponentDef<SegmentColliderData>
+BuiltinComponentDef<SegmentCollider2DData>
```
-## SegmentColliderData — interface @experimental
+## SegmentCollider2DData — interface @experimental
```
categoryBits: number
density: number
@@ -648,12 +648,12 @@ nx: number
ny: number
```
-## WeldJoint — const @experimental
+## WeldJoint2D — const @experimental
```
-ComponentDef<WeldJointData>
+ComponentDef<WeldJoint2DData>
```
-## WeldJointData — interface @experimental
+## WeldJoint2DData — interface @experimental
```
anchorA: Vec2
anchorB: Vec2
@@ -666,12 +666,12 @@ linearDampingRatio: number
linearHertz: number
```
-## WheelJoint — const @experimental
+## WheelJoint2D — const @experimental
```
-ComponentDef<WheelJointData>
+ComponentDef<WheelJoint2DData>
```
-## WheelJointData — interface @experimental
+## WheelJoint2DData — interface @experimental
```
anchorA: Vec2
anchorB: Vec2
diff --git a/sdk/etc/wasm.api.md b/sdk/etc/wasm.api.md
index 436c31fb8..73e7fad28 100644
--- a/sdk/etc/wasm.api.md
+++ b/sdk/etc/wasm.api.md
@@ -14,15 +14,15 @@ shutdown: () => void
## CppRegistry — interface @experimental
```
addBitmapText: (entity: Entity, component: BitmapText) => void
+addBoxCollider2D: (entity: Entity, component: BoxCollider2D) => void
addBoxCollider3D: (entity: Entity, component: BoxCollider3D) => void
-addBoxCollider: (entity: Entity, component: BoxCollider) => void
addCamera: (entity: Entity, component: Camera) => void
addCanvas: (entity: Entity, component: Canvas) => void
+addCapsuleCollider2D: (entity: Entity, component: CapsuleCollider2D) => void
addCapsuleCollider3D: (entity: Entity, component: CapsuleCollider3D) => void
-addCapsuleCollider: (entity: Entity, component: CapsuleCollider) => void
addCharacterController3D: (entity: Entity, component: CharacterController3D) => void
addChildren: (entity: Entity, component: Children) => void
-addCircleCollider: (entity: Entity, component: CircleCollider) => void
+addCircleCollider2D: (entity: Entity, component: CircleCollider2D) => void
addConvexCollider3D: (entity: Entity, component: ConvexCollider3D) => void
addDraggable: (entity: Entity, component: Draggable) => void
addDragonBonesAnimation: (entity: Entity, component: DragonBonesAnimation) => void
@@ -35,9 +35,9 @@ addMeshSkin: (entity: Entity, component: MeshSkin) => void
addParent: (entity: Entity, component: Parent) => void
addParticleEmitter: (entity: Entity, component: ParticleEmitter) => void
addParticleForceField: (entity: Entity, component: ParticleForceField) => void
+addRigidBody2D: (entity: Entity, component: RigidBody2D) => void
addRigidBody3D: (entity: Entity, component: RigidBody3D) => void
-addRigidBody: (entity: Entity, component: RigidBody) => void
-addSegmentCollider: (entity: Entity, component: SegmentCollider) => void
+addSegmentCollider2D: (entity: Entity, component: SegmentCollider2D) => void
addShadowCaster2D: (entity: Entity, component: ShadowCaster2D) => void
addShapeRenderer: (entity: Entity, component: ShapeRenderer) => void
addSphereCollider3D: (entity: Entity, component: SphereCollider3D) => void
@@ -57,15 +57,15 @@ delete: () => void
destroy: (entity: Entity) => void
entityCount: () => number
getBitmapText: (entity: Entity) => BitmapText
+getBoxCollider2D: (entity: Entity) => BoxCollider2D
getBoxCollider3D: (entity: Entity) => BoxCollider3D
-getBoxCollider: (entity: Entity) => BoxCollider
getCamera: (entity: Entity) => Camera
getCanvas: (entity: Entity) => Canvas
+getCapsuleCollider2D: (entity: Entity) => CapsuleCollider2D
getCapsuleCollider3D: (entity: Entity) => CapsuleCollider3D
-getCapsuleCollider: (entity: Entity) => CapsuleCollider
getCharacterController3D: (entity: Entity) => CharacterController3D
getChildren: (entity: Entity) => Children
-getCircleCollider: (entity: Entity) => CircleCollider
+getCircleCollider2D: (entity: Entity) => CircleCollider2D
getConvexCollider3D: (entity: Entity) => ConvexCollider3D
getDraggable: (entity: Entity) => Draggable
getDragonBonesAnimation: (entity: Entity) => DragonBonesAnimation
@@ -78,9 +78,9 @@ getMeshSkin: (entity: Entity) => MeshSkin
getParent: (entity: Entity) => Parent
getParticleEmitter: (entity: Entity) => ParticleEmitter
getParticleForceField: (entity: Entity) => ParticleForceField
+getRigidBody2D: (entity: Entity) => RigidBody2D
getRigidBody3D: (entity: Entity) => RigidBody3D
-getRigidBody: (entity: Entity) => RigidBody
-getSegmentCollider: (entity: Entity) => SegmentCollider
+getSegmentCollider2D: (entity: Entity) => SegmentCollider2D
getShadowCaster2D: (entity: Entity) => ShadowCaster2D
getShapeRenderer: (entity: Entity) => ShapeRenderer
getSphereCollider3D: (entity: Entity) => SphereCollider3D
@@ -96,15 +96,15 @@ getUIScroll: (entity: Entity) => UIScroll
getUIVisual: (entity: Entity) => UIVisual
getVelocity: (entity: Entity) => Velocity
hasBitmapText: (entity: Entity) => boolean
+hasBoxCollider2D: (entity: Entity) => boolean
hasBoxCollider3D: (entity: Entity) => boolean
-hasBoxCollider: (entity: Entity) => boolean
hasCamera: (entity: Entity) => boolean
hasCanvas: (entity: Entity) => boolean
+hasCapsuleCollider2D: (entity: Entity) => boolean
hasCapsuleCollider3D: (entity: Entity) => boolean
-hasCapsuleCollider: (entity: Entity) => boolean
hasCharacterController3D: (entity: Entity) => boolean
hasChildren: (entity: Entity) => boolean
-hasCircleCollider: (entity: Entity) => boolean
+hasCircleCollider2D: (entity: Entity) => boolean
hasConvexCollider3D: (entity: Entity) => boolean
hasDraggable: (entity: Entity) => boolean
hasDragonBonesAnimation: (entity: Entity) => boolean
@@ -117,9 +117,9 @@ hasMeshSkin: (entity: Entity) => boolean
hasParent: (entity: Entity) => boolean
hasParticleEmitter: (entity: Entity) => boolean
hasParticleForceField: (entity: Entity) => boolean
+hasRigidBody2D: (entity: Entity) => boolean
hasRigidBody3D: (entity: Entity) => boolean
-hasRigidBody: (entity: Entity) => boolean
-hasSegmentCollider: (entity: Entity) => boolean
+hasSegmentCollider2D: (entity: Entity) => boolean
hasShadowCaster2D: (entity: Entity) => boolean
hasShapeRenderer: (entity: Entity) => boolean
hasSphereCollider3D: (entity: Entity) => boolean
@@ -135,15 +135,15 @@ hasUIScroll: (entity: Entity) => boolean
hasUIVisual: (entity: Entity) => boolean
hasVelocity: (entity: Entity) => boolean
removeBitmapText: (entity: Entity) => void
+removeBoxCollider2D: (entity: Entity) => void
removeBoxCollider3D: (entity: Entity) => void
-removeBoxCollider: (entity: Entity) => void
removeCamera: (entity: Entity) => void
removeCanvas: (entity: Entity) => void
+removeCapsuleCollider2D: (entity: Entity) => void
removeCapsuleCollider3D: (entity: Entity) => void
-removeCapsuleCollider: (entity: Entity) => void
removeCharacterController3D: (entity: Entity) => void
removeChildren: (entity: Entity) => void
-removeCircleCollider: (entity: Entity) => void
+removeCircleCollider2D: (entity: Entity) => void
removeConvexCollider3D: (entity: Entity) => void
removeDraggable: (entity: Entity) => void
removeDragonBonesAnimation: (entity: Entity) => void
@@ -156,9 +156,9 @@ removeMeshSkin: (entity: Entity) => void
removeParent: (entity: Entity) => void
removeParticleEmitter: (entity: Entity) => void
removeParticleForceField: (entity: Entity) => void
+removeRigidBody2D: (entity: Entity) => void
removeRigidBody3D: (entity: Entity) => void
-removeRigidBody: (entity: Entity) => void
-removeSegmentCollider: (entity: Entity) => void
+removeSegmentCollider2D: (entity: Entity) => void
removeShadowCaster2D: (entity: Entity) => void
removeShapeRenderer: (entity: Entity) => void
removeSphereCollider3D: (entity: Entity) => void
diff --git a/sdk/etc/wechat.api.md b/sdk/etc/wechat.api.md
index b4fabf82b..11b83afb4 100644
--- a/sdk/etc/wechat.api.md
+++ b/sdk/etc/wechat.api.md
@@ -1241,9 +1241,23 @@ Kinematic = 1
Static = 0
```
-## BoxCollider — const @experimental
+## BoxCollider2D — const @experimental
```
-BuiltinComponentDef<BoxColliderData>
+BuiltinComponentDef<BoxCollider2DData>
+```
+
+## BoxCollider2DData — interface @experimental
+```
+categoryBits: number
+density: number
+enabled: boolean
+friction: number
+halfExtents: Vec2
+isSensor: boolean
+maskBits: number
+offset: Vec2
+radius: number
+restitution: number
```
## BoxCollider3D — const @experimental
@@ -1260,20 +1274,6 @@ isSensor: boolean
restitution: number
```
-## BoxColliderData — interface @experimental
-```
-categoryBits: number
-density: number
-enabled: boolean
-friction: number
-halfExtents: Vec2
-isSensor: boolean
-maskBits: number
-offset: Vec2
-radius: number
-restitution: number
-```
-
## BtDefinition — interface @experimental
```
orphans: BtNode[] | undefined
@@ -1671,36 +1671,36 @@ update: () => void
width: number
```
-## CapsuleCollider — const @experimental
-```
-BuiltinComponentDef<CapsuleColliderData>
-```
-
-## CapsuleCollider3D — const @experimental
+## CapsuleCollider2D — const @experimental
```
-BuiltinComponentDef<CapsuleCollider3DData>
+BuiltinComponentDef<CapsuleCollider2DData>
```
-## CapsuleCollider3DData — interface @experimental
+## CapsuleCollider2DData — interface @experimental
```
+categoryBits: number
+density: number
enabled: boolean
friction: number
halfHeight: number
isSensor: boolean
+maskBits: number
+offset: Vec2
radius: number
restitution: number
```
-## CapsuleColliderData — interface @experimental
+## CapsuleCollider3D — const @experimental
+```
+BuiltinComponentDef<CapsuleCollider3DData>
+```
+
+## CapsuleCollider3DData — interface @experimental
```
-categoryBits: number
-density: number
enabled: boolean
friction: number
halfHeight: number
isSensor: boolean
-maskBits: number
-offset: Vec2
radius: number
restitution: number
```
@@ -1867,9 +1867,9 @@ tier: CensusTier
unit: "count" | "bytes"
```
-## ChainCollider — const @experimental
+## ChainCollider2D — const @experimental
```
-ComponentDef<ChainColliderData>
+ComponentDef<ChainCollider2DData>
```
## Changed — function @experimental
@@ -1883,9 +1883,26 @@ ComponentDef<ChainColliderData>
@internal _filterType: "changed"
```
-## CharacterController — const @beta
+## CharacterController2D — const @beta
```
-ComponentDef<CharacterControllerData>
+ComponentDef<CharacterController2DData>
+```
+
+## CharacterController2DData — interface @experimental
+```
+floorMaxAngle: number
+floorNormal: Vec2
+isOnCeiling: boolean
+isOnFloor: boolean
+isOnWall: boolean
+maskBits: number
+maxSlides: number
+realVelocity: Vec2
+skinWidth: number
+slideOnCeiling: boolean
+snapLength: number
+up: Vec2
+velocity: Vec2
```
## CharacterController3D — const @beta
@@ -1910,23 +1927,6 @@ stepHeight: number
velocity: Vec3
```
-## CharacterControllerData — interface @experimental
-```
-floorMaxAngle: number
-floorNormal: Vec2
-isOnCeiling: boolean
-isOnFloor: boolean
-isOnWall: boolean
-maskBits: number
-maxSlides: number
-realVelocity: Vec2
-skinWidth: number
-slideOnCeiling: boolean
-snapLength: number
-up: Vec2
-velocity: Vec2
-```
-
## Children — const @public
```
BuiltinComponentDef<ChildrenData>
@@ -1937,12 +1937,12 @@ BuiltinComponentDef<ChildrenData>
entities: number[]
```
-## CircleCollider — const @experimental
+## CircleCollider2D — const @experimental
```
-BuiltinComponentDef<CircleColliderData>
+BuiltinComponentDef<CircleCollider2DData>
```
-## CircleColliderData — interface @experimental
+## CircleCollider2DData — interface @experimental
```
categoryBits: number
density: number
@@ -2535,9 +2535,9 @@ value: number
ComponentDef<{}>
```
-## DistanceJoint — const @experimental
+## DistanceJoint2D — const @experimental
```
-ComponentDef<DistanceJointData>
+ComponentDef<DistanceJoint2DData>
```
## DistanceJoint3D — const @beta
@@ -4640,9 +4640,9 @@ meta: boolean
shift: boolean
```
-## MotorJoint — const @experimental
+## MotorJoint2D — const @experimental
```
-ComponentDef<MotorJointData>
+ComponentDef<MotorJoint2DData>
```
## MouseButton — const @public
@@ -5005,9 +5005,9 @@ params: NodeParamSpec[]
(filter: FilterExpr): FilterExpr
```
-## OneWayPlatform — const @experimental
+## OneWayPlatform2D — const @experimental
```
-ComponentDef<OneWayPlatformData>
+ComponentDef<OneWayPlatform2DData>
```
## Or — function @experimental
@@ -5760,9 +5760,9 @@ connectedEntity: number
enabled: boolean
```
-## PolygonCollider — const @experimental
+## PolygonCollider2D — const @experimental
```
-ComponentDef<PolygonColliderData>
+ComponentDef<PolygonCollider2DData>
```
## PooledAudioNode — interface @experimental
@@ -5974,9 +5974,9 @@ static new (): PrefabsPlugin
static prototype: PrefabsPlugin
```
-## PrismaticJoint — const @experimental
+## PrismaticJoint2D — const @experimental
```
-ComponentDef<PrismaticJointData>
+ComponentDef<PrismaticJoint2DData>
```
## ProbedRegistrations — interface @experimental
@@ -6487,9 +6487,9 @@ type: "reverb"
wet: number | undefined
```
-## RevoluteJoint — const @experimental
+## RevoluteJoint2D — const @experimental
```
-ComponentDef<RevoluteJointData>
+ComponentDef<RevoluteJoint2DData>
```
## RichTextRun — type @experimental
@@ -6497,36 +6497,36 @@ ComponentDef<RevoluteJointData>
TextSegment | ImageSegment
```
-## RigidBody — const @experimental
-```
-BuiltinComponentDef<RigidBodyData>
-```
-
-## RigidBody3D — const @experimental
+## RigidBody2D — const @experimental
```
-BuiltinComponentDef<RigidBody3DData>
+BuiltinComponentDef<RigidBody2DData>
```
-## RigidBody3DData — interface @experimental
+## RigidBody2DData — interface @experimental
```
angularDamping: number
bodyType: number
-continuousCollision: boolean
+bullet: boolean
enabled: boolean
fixedRotation: boolean
gravityScale: number
-layer: number
linearDamping: number
```
-## RigidBodyData — interface @experimental
+## RigidBody3D — const @experimental
+```
+BuiltinComponentDef<RigidBody3DData>
+```
+
+## RigidBody3DData — interface @experimental
```
angularDamping: number
bodyType: number
-bullet: boolean
+continuousCollision: boolean
enabled: boolean
fixedRotation: boolean
gravityScale: number
+layer: number
linearDamping: number
```
@@ -6596,7 +6596,7 @@ ComponentDef<{}>
## SCENE_FORMAT_VERSION — const @experimental
```
-2
+3
```
## SCREEN_FIT_OFF — const @experimental
@@ -7021,9 +7021,9 @@ wheelSpeed: number | undefined
world: World
```
-## SegmentCollider — const @experimental
+## SegmentCollider2D — const @experimental
```
-BuiltinComponentDef<SegmentColliderData>
+BuiltinComponentDef<SegmentCollider2DData>
```
## SenseResult — interface @experimental
@@ -9228,14 +9228,14 @@ device: unknown
reason: string | undefined
```
-## WeldJoint — const @experimental
+## WeldJoint2D — const @experimental
```
-ComponentDef<WeldJointData>
+ComponentDef<WeldJoint2DData>
```
-## WheelJoint — const @experimental
+## WheelJoint2D — const @experimental
```
-ComponentDef<WheelJointData>
+ComponentDef<WheelJoint2DData>
```
## WidgetInteractionInit — interface @experimental
diff --git a/sdk/src/behavior.ts b/sdk/src/behavior.ts
index 1b35be2b4..c1ffe6607 100644
--- a/sdk/src/behavior.ts
+++ b/sdk/src/behavior.ts
@@ -48,7 +48,7 @@ export interface BehaviorContext<S extends object> {
* Read another component on THIS entity.
*
* For a script component this IS the stored object, so mutating it sticks.
- * For an ENGINE component (Transform, Sprite, RigidBody — anything C++-backed)
+ * For an ENGINE component (Transform, Sprite, RigidBody2D — anything C++-backed)
* it is a copy decoded out of the wasm heap: mutating it changes nothing.
* Read it, change it, and hand it back through {@link set}.
*/
diff --git a/sdk/src/core-runtime.ts b/sdk/src/core-runtime.ts
index 90713c337..462f29952 100644
--- a/sdk/src/core-runtime.ts
+++ b/sdk/src/core-runtime.ts
@@ -130,10 +130,10 @@ export {
type TrailRendererData,
type SpineAnimationData,
type DragonBonesAnimationData,
- type RigidBodyData,
- type BoxColliderData,
- type CircleColliderData,
- type CapsuleColliderData,
+ type RigidBody2DData,
+ type BoxCollider2DData,
+ type CircleCollider2DData,
+ type CapsuleCollider2DData,
type NameData,
type SceneOwnerData,
type MarkerData,
@@ -151,27 +151,27 @@ export {
} from './ecs/component';
export {
- RigidBody,
- BoxCollider,
- CircleCollider,
- CapsuleCollider,
- SegmentCollider,
- PolygonCollider,
- ChainCollider,
- OneWayPlatform,
- RevoluteJoint,
- DistanceJoint,
- PrismaticJoint,
- WeldJoint,
- WheelJoint,
- MotorJoint,
+ RigidBody2D,
+ BoxCollider2D,
+ CircleCollider2D,
+ CapsuleCollider2D,
+ SegmentCollider2D,
+ PolygonCollider2D,
+ ChainCollider2D,
+ OneWayPlatform2D,
+ RevoluteJoint2D,
+ DistanceJoint2D,
+ PrismaticJoint2D,
+ WeldJoint2D,
+ WheelJoint2D,
+ MotorJoint2D,
BodyType,
} from './physics/PhysicsComponents';
export {
- CharacterController,
- type CharacterControllerData,
-} from './physics/CharacterController';
+ CharacterController2D,
+ type CharacterController2DData,
+} from './physics/CharacterController2D';
export {
readColliderShapes,
diff --git a/sdk/src/ecs/bridge/ptrAccessors.generated.ts b/sdk/src/ecs/bridge/ptrAccessors.generated.ts
index 70611af59..aa9591c43 100644
--- a/sdk/src/ecs/bridge/ptrAccessors.generated.ts
+++ b/sdk/src/ecs/bridge/ptrAccessors.generated.ts
@@ -61,7 +61,7 @@ export function createBitmapTextData(): BitmapTextPtrData {
};
}
-export interface BoxColliderPtrData {
+export interface BoxCollider2DPtrData {
halfExtents: Vec2;
offset: Vec2;
density: number;
@@ -73,9 +73,9 @@ export interface BoxColliderPtrData {
maskBits: number;
}
-export function fillBoxCollider(
+export function fillBoxCollider2D(
f32: Float32Array, u32: Uint32Array, u8: Uint8Array,
- ptr: number, out: BoxColliderPtrData,
+ ptr: number, out: BoxCollider2DPtrData,
): void {
const halfExtents_ = out.halfExtents; halfExtents_.x = f32[ptr >> 2]; halfExtents_.y = f32[(ptr >> 2) + 1];
const offset_ = out.offset; offset_.x = f32[(ptr + 8) >> 2]; offset_.y = f32[((ptr + 8) >> 2) + 1];
@@ -88,9 +88,9 @@ export function fillBoxCollider(
out.maskBits = u32[(ptr + 36) >> 2];
}
-export function writeBoxCollider(
+export function writeBoxCollider2D(
f32: Float32Array, u32: Uint32Array, u8: Uint8Array,
- ptr: number, data: BoxColliderPtrData,
+ ptr: number, data: BoxCollider2DPtrData,
): void {
f32[ptr >> 2] = data.halfExtents.x; f32[(ptr >> 2) + 1] = data.halfExtents.y;
f32[(ptr + 8) >> 2] = data.offset.x; f32[((ptr + 8) >> 2) + 1] = data.offset.y;
@@ -103,7 +103,7 @@ export function writeBoxCollider(
u32[(ptr + 36) >> 2] = data.maskBits;
}
-export function createBoxColliderData(): BoxColliderPtrData {
+export function createBoxCollider2DData(): BoxCollider2DPtrData {
return {
halfExtents: { x: 0, y: 0 },
offset: { x: 0, y: 0 },
@@ -273,7 +273,7 @@ export function createCanvasData(): CanvasPtrData {
};
}
-export interface CapsuleColliderPtrData {
+export interface CapsuleCollider2DPtrData {
radius: number;
halfHeight: number;
offset: Vec2;
@@ -286,9 +286,9 @@ export interface CapsuleColliderPtrData {
maskBits: number;
}
-export function fillCapsuleCollider(
+export function fillCapsuleCollider2D(
f32: Float32Array, u32: Uint32Array, u8: Uint8Array,
- ptr: number, out: CapsuleColliderPtrData,
+ ptr: number, out: CapsuleCollider2DPtrData,
): void {
out.radius = f32[ptr >> 2];
out.halfHeight = f32[(ptr + 4) >> 2];
@@ -302,9 +302,9 @@ export function fillCapsuleCollider(
out.maskBits = u32[(ptr + 36) >> 2];
}
-export function writeCapsuleCollider(
+export function writeCapsuleCollider2D(
f32: Float32Array, u32: Uint32Array, u8: Uint8Array,
- ptr: number, data: CapsuleColliderPtrData,
+ ptr: number, data: CapsuleCollider2DPtrData,
): void {
f32[ptr >> 2] = data.radius;
f32[(ptr + 4) >> 2] = data.halfHeight;
@@ -318,7 +318,7 @@ export function writeCapsuleCollider(
u32[(ptr + 36) >> 2] = data.maskBits;
}
-export function createCapsuleColliderData(): CapsuleColliderPtrData {
+export function createCapsuleCollider2DData(): CapsuleCollider2DPtrData {
return {
radius: 0,
halfHeight: 0,
@@ -449,7 +449,7 @@ export function createCharacterController3DData(): CharacterController3DPtrData
};
}
-export interface CircleColliderPtrData {
+export interface CircleCollider2DPtrData {
radius: number;
offset: Vec2;
density: number;
@@ -461,9 +461,9 @@ export interface CircleColliderPtrData {
maskBits: number;
}
-export function fillCircleCollider(
+export function fillCircleCollider2D(
f32: Float32Array, u32: Uint32Array, u8: Uint8Array,
- ptr: number, out: CircleColliderPtrData,
+ ptr: number, out: CircleCollider2DPtrData,
): void {
out.radius = f32[ptr >> 2];
const offset_ = out.offset; offset_.x = f32[(ptr + 4) >> 2]; offset_.y = f32[((ptr + 4) >> 2) + 1];
@@ -476,9 +476,9 @@ export function fillCircleCollider(
out.maskBits = u32[(ptr + 32) >> 2];
}
-export function writeCircleCollider(
+export function writeCircleCollider2D(
f32: Float32Array, u32: Uint32Array, u8: Uint8Array,
- ptr: number, data: CircleColliderPtrData,
+ ptr: number, data: CircleCollider2DPtrData,
): void {
f32[ptr >> 2] = data.radius;
f32[(ptr + 4) >> 2] = data.offset.x; f32[((ptr + 4) >> 2) + 1] = data.offset.y;
@@ -491,7 +491,7 @@ export function writeCircleCollider(
u32[(ptr + 32) >> 2] = data.maskBits;
}
-export function createCircleColliderData(): CircleColliderPtrData {
+export function createCircleCollider2DData(): CircleCollider2DPtrData {
return {
radius: 0,
offset: { x: 0, y: 0 },
@@ -1217,7 +1217,7 @@ export function createParticleForceFieldData(): ParticleForceFieldPtrData {
};
}
-export interface RigidBodyPtrData {
+export interface RigidBody2DPtrData {
bodyType: number;
gravityScale: number;
linearDamping: number;
@@ -1227,9 +1227,9 @@ export interface RigidBodyPtrData {
enabled: boolean;
}
-export function fillRigidBody(
+export function fillRigidBody2D(
f32: Float32Array, u32: Uint32Array, u8: Uint8Array,
- ptr: number, out: RigidBodyPtrData,
+ ptr: number, out: RigidBody2DPtrData,
): void {
out.bodyType = u8[ptr];
out.gravityScale = f32[(ptr + 4) >> 2];
@@ -1240,9 +1240,9 @@ export function fillRigidBody(
out.enabled = u8[ptr + 18] !== 0;
}
-export function writeRigidBody(
+export function writeRigidBody2D(
f32: Float32Array, u32: Uint32Array, u8: Uint8Array,
- ptr: number, data: RigidBodyPtrData,
+ ptr: number, data: RigidBody2DPtrData,
): void {
u8[ptr] = data.bodyType;
f32[(ptr + 4) >> 2] = data.gravityScale;
@@ -1253,7 +1253,7 @@ export function writeRigidBody(
u8[ptr + 18] = data.enabled ? 1 : 0;
}
-export function createRigidBodyData(): RigidBodyPtrData {
+export function createRigidBody2DData(): RigidBody2DPtrData {
return {
bodyType: 0,
gravityScale: 0,
@@ -1317,7 +1317,7 @@ export function createRigidBody3DData(): RigidBody3DPtrData {
};
}
-export interface SegmentColliderPtrData {
+export interface SegmentCollider2DPtrData {
point1: Vec2;
point2: Vec2;
density: number;
@@ -1329,9 +1329,9 @@ export interface SegmentColliderPtrData {
maskBits: number;
}
-export function fillSegmentCollider(
+export function fillSegmentCollider2D(
f32: Float32Array, u32: Uint32Array, u8: Uint8Array,
- ptr: number, out: SegmentColliderPtrData,
+ ptr: number, out: SegmentCollider2DPtrData,
): void {
const point1_ = out.point1; point1_.x = f32[ptr >> 2]; point1_.y = f32[(ptr >> 2) + 1];
const point2_ = out.point2; point2_.x = f32[(ptr + 8) >> 2]; point2_.y = f32[((ptr + 8) >> 2) + 1];
@@ -1344,9 +1344,9 @@ export function fillSegmentCollider(
out.maskBits = u32[(ptr + 36) >> 2];
}
-export function writeSegmentCollider(
+export function writeSegmentCollider2D(
f32: Float32Array, u32: Uint32Array, u8: Uint8Array,
- ptr: number, data: SegmentColliderPtrData,
+ ptr: number, data: SegmentCollider2DPtrData,
): void {
f32[ptr >> 2] = data.point1.x; f32[(ptr >> 2) + 1] = data.point1.y;
f32[(ptr + 8) >> 2] = data.point2.x; f32[((ptr + 8) >> 2) + 1] = data.point2.y;
@@ -1359,7 +1359,7 @@ export function writeSegmentCollider(
u32[(ptr + 36) >> 2] = data.maskBits;
}
-export function createSegmentColliderData(): SegmentColliderPtrData {
+export function createSegmentCollider2DData(): SegmentCollider2DPtrData {
return {
point1: { x: 0, y: 0 },
point2: { x: 0, y: 0 },
@@ -2149,14 +2149,14 @@ export interface PtrAccessor<T> {
export const PTR_ACCESSORS: Record<string, PtrAccessor<any>> = {
BitmapText: { fill: fillBitmapText, write: writeBitmapText, create: createBitmapTextData },
- BoxCollider: { fill: fillBoxCollider, write: writeBoxCollider, create: createBoxColliderData },
+ BoxCollider2D: { fill: fillBoxCollider2D, write: writeBoxCollider2D, create: createBoxCollider2DData },
BoxCollider3D: { fill: fillBoxCollider3D, write: writeBoxCollider3D, create: createBoxCollider3DData },
Camera: { fill: fillCamera, write: writeCamera, create: createCameraData },
Canvas: { fill: fillCanvas, write: writeCanvas, create: createCanvasData },
- CapsuleCollider: { fill: fillCapsuleCollider, write: writeCapsuleCollider, create: createCapsuleColliderData },
+ CapsuleCollider2D: { fill: fillCapsuleCollider2D, write: writeCapsuleCollider2D, create: createCapsuleCollider2DData },
CapsuleCollider3D: { fill: fillCapsuleCollider3D, write: writeCapsuleCollider3D, create: createCapsuleCollider3DData },
CharacterController3D: { fill: fillCharacterController3D, write: writeCharacterController3D, create: createCharacterController3DData },
- CircleCollider: { fill: fillCircleCollider, write: writeCircleCollider, create: createCircleColliderData },
+ CircleCollider2D: { fill: fillCircleCollider2D, write: writeCircleCollider2D, create: createCircleCollider2DData },
ConvexCollider3D: { fill: fillConvexCollider3D, write: writeConvexCollider3D, create: createConvexCollider3DData },
Draggable: { fill: fillDraggable, write: writeDraggable, create: createDraggableData },
DragonBonesAnimation: { fill: fillDragonBonesAnimation, write: writeDragonBonesAnimation, create: createDragonBonesAnimationData },
@@ -2167,9 +2167,9 @@ export const PTR_ACCESSORS: Record<string, PtrAccessor<any>> = {
MeshRenderer: { fill: fillMeshRenderer, write: writeMeshRenderer, create: createMeshRendererData },
ParticleEmitter: { fill: fillParticleEmitter, write: writeParticleEmitter, create: createParticleEmitterData },
ParticleForceField: { fill: fillParticleForceField, write: writeParticleForceField, create: createParticleForceFieldData },
- RigidBody: { fill: fillRigidBody, write: writeRigidBody, create: createRigidBodyData },
+ RigidBody2D: { fill: fillRigidBody2D, write: writeRigidBody2D, create: createRigidBody2DData },
RigidBody3D: { fill: fillRigidBody3D, write: writeRigidBody3D, create: createRigidBody3DData },
- SegmentCollider: { fill: fillSegmentCollider, write: writeSegmentCollider, create: createSegmentColliderData },
+ SegmentCollider2D: { fill: fillSegmentCollider2D, write: writeSegmentCollider2D, create: createSegmentCollider2DData },
ShadowCaster2D: { fill: fillShadowCaster2D, write: writeShadowCaster2D, create: createShadowCaster2DData },
ShapeRenderer: { fill: fillShapeRenderer, write: writeShapeRenderer, create: createShapeRendererData },
SphereCollider3D: { fill: fillSphereCollider3D, write: writeSphereCollider3D, create: createSphereCollider3DData },
diff --git a/sdk/src/ecs/component.generated.ts b/sdk/src/ecs/component.generated.ts
index 414edf4d0..9a88a920b 100644
--- a/sdk/src/ecs/component.generated.ts
+++ b/sdk/src/ecs/component.generated.ts
@@ -15,7 +15,7 @@ import type { Dimension, Padding } from '../wasm/wasm.generated';
* getAbiLayoutHash(); BuiltinBridge.connect() compares them and refuses to
* run on mismatch, because mismatched offsets read the wrong heap bytes.
*/
-export const ABI_LAYOUT_HASH = 'f4ba1e6b5d361dee';
+export const ABI_LAYOUT_HASH = '70afde061183c505';
/**
* One asset-valued field of a component: which field, and what kind of
@@ -112,7 +112,7 @@ export const COMPONENT_META: Record<string, ComponentMetaEntry> = {
layer: { step: 1 },
},
},
- BoxCollider: {
+ BoxCollider2D: {
defaults: {
halfExtents: { x: 0.5, y: 0.5 },
offset: { x: 0, y: 0 },
@@ -206,7 +206,7 @@ export const COMPONENT_META: Record<string, ComponentMetaEntry> = {
layer: { step: 1, tooltip: "Sorting layer this UI belongs to — cameras cull by it.", enumSource: "sortingLayers" },
},
},
- CapsuleCollider: {
+ CapsuleCollider2D: {
defaults: {
radius: 0.25,
halfHeight: 0.5,
@@ -287,7 +287,7 @@ export const COMPONENT_META: Record<string, ComponentMetaEntry> = {
colorFields: [],
animatableFields: [],
},
- CircleCollider: {
+ CircleCollider2D: {
defaults: {
radius: 0.5,
offset: { x: 0, y: 0 },
@@ -668,7 +668,7 @@ export const COMPONENT_META: Record<string, ComponentMetaEntry> = {
falloff: { category: "Field" },
},
},
- RigidBody: {
+ RigidBody2D: {
defaults: {
bodyType: 2,
gravityScale: 1,
@@ -710,7 +710,7 @@ export const COMPONENT_META: Record<string, ComponentMetaEntry> = {
continuousCollision: { advanced: true },
},
},
- SegmentCollider: {
+ SegmentCollider2D: {
defaults: {
point1: { x: -0.5, y: 0 },
point2: { x: 0.5, y: 0 },
@@ -1081,7 +1081,7 @@ export interface BitmapTextData {
enabled: boolean;
}
-export interface BoxColliderData {
+export interface BoxCollider2DData {
halfExtents: Vec2;
offset: Vec2;
density: number;
@@ -1126,7 +1126,7 @@ export interface CanvasData {
layer: number;
}
-export interface CapsuleColliderData {
+export interface CapsuleCollider2DData {
radius: number;
halfHeight: number;
offset: Vec2;
@@ -1174,7 +1174,7 @@ export interface ChildrenData {
entities: Entity[];
}
-export interface CircleColliderData {
+export interface CircleCollider2DData {
radius: number;
offset: Vec2;
density: number;
@@ -1362,7 +1362,7 @@ export interface ParticleForceFieldData {
enabled: boolean;
}
-export interface RigidBodyData {
+export interface RigidBody2DData {
bodyType: number;
gravityScale: number;
linearDamping: number;
@@ -1383,7 +1383,7 @@ export interface RigidBody3DData {
enabled: boolean;
}
-export interface SegmentColliderData {
+export interface SegmentCollider2DData {
point1: Vec2;
point2: Vec2;
density: number;
diff --git a/sdk/src/ecs/component.ts b/sdk/src/ecs/component.ts
index 02da3641c..eb989080e 100644
--- a/sdk/src/ecs/component.ts
+++ b/sdk/src/ecs/component.ts
@@ -29,7 +29,7 @@ import { ProjectionType, ClearFlags, EmitterShape, SimulationSpace, SubEmitterTr
import { BlendMode } from '../render/blend';
import { getDefaultContext } from './context';
import type {
- RigidBodyData, BoxColliderData, CircleColliderData, CapsuleColliderData,
+ RigidBody2DData, BoxCollider2DData, CircleCollider2DData, CapsuleCollider2DData,
} from '../physics/PhysicsComponents';
// =============================================================================
@@ -1194,7 +1194,7 @@ export const PostProcessVolume = defineComponent<PostProcessVolumeData>('PostPro
});
export type {
- RigidBodyData, BoxColliderData, CircleColliderData, CapsuleColliderData,
+ RigidBody2DData, BoxCollider2DData, CircleCollider2DData, CapsuleCollider2DData,
};
// =============================================================================
diff --git a/sdk/src/physics/CharacterController.ts b/sdk/src/physics/CharacterController2D.ts
similarity index 93%
rename from sdk/src/physics/CharacterController.ts
rename to sdk/src/physics/CharacterController2D.ts
index 8fa386f1b..3fb01efd1 100644
--- a/sdk/src/physics/CharacterController.ts
+++ b/sdk/src/physics/CharacterController2D.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
/**
- * @file CharacterController.ts
+ * @file CharacterController2D.ts
* @brief Kinematic character controller (Godot CharacterBody2D semantics) on top
* of Box2D v3's native kinematic mover.
*
@@ -11,7 +11,7 @@
* depenetrating slide. That resolves a character resting on the ground with valid
* normals (a generic shape cast reports the resting contact as a zero-normal
* fraction-0 hit and wedges). It writes the resolved pose to `Transform`; if the
- * entity also carries a Kinematic `RigidBody`, `PhysicsStepSystem` then pushes that
+ * entity also carries a Kinematic `RigidBody2D`, `PhysicsStepSystem` then pushes that
* Transform into Box2D so dynamic bodies see the character.
*
* `moveAndSlide` below is the earlier pure JS resolver, kept as a standalone utility
@@ -29,10 +29,10 @@ import { Res, Time, type TimeData } from '../ecs/resource';
import { playModeOnly } from '../ecs/env';
import { Physics, type PhysicsAPI } from './Physics';
import { readPixelsPerUnit } from './PhysicsSystem';
-import { BoxCollider, CircleCollider, CapsuleCollider, activeCollider } from './PhysicsComponents';
+import { BoxCollider2D, CircleCollider2D, CapsuleCollider2D, activeCollider } from './PhysicsComponents';
import { log } from '../util/logger';
import type {
- BoxColliderData, CircleColliderData, CapsuleColliderData,
+ BoxCollider2DData, CircleCollider2DData, CapsuleCollider2DData,
} from './PhysicsComponents';
import type { MoverResult } from './PhysicsTypes';
import type { World } from '../ecs/world';
@@ -41,7 +41,7 @@ import type { World } from '../ecs/world';
// Component
// =============================================================================
-export interface CharacterControllerData {
+export interface CharacterController2DData {
/** Desired velocity in world pixels/second; set it from gameplay each step. */
velocity: Vec2;
/** Up direction for floor/ceiling classification (opposes gravity). */
@@ -77,7 +77,7 @@ export interface CharacterControllerData {
*
* @beta
*/
-export const CharacterController = defineComponent<CharacterControllerData>('CharacterController', {
+export const CharacterController2D = defineComponent<CharacterController2DData>('CharacterController2D', {
velocity: { x: 0, y: 0 },
up: { x: 0, y: 1 },
floorMaxAngle: 0.785398, // 45°
@@ -248,15 +248,15 @@ type CastShape =
/** Read the entity's collider into a pixel-space cast shape, or null if it has no
* enabled one — a disabled collider is no collider, here as everywhere. */
function resolveCastShape(world: World, entity: Entity, ppu: number): CastShape | null {
- const box = activeCollider(world, entity, BoxCollider) as BoxColliderData | null;
+ const box = activeCollider(world, entity, BoxCollider2D) as BoxCollider2DData | null;
if (box) {
return { kind: 'box', hx: box.halfExtents.x * ppu, hy: box.halfExtents.y * ppu, ox: box.offset.x * ppu, oy: box.offset.y * ppu };
}
- const circle = activeCollider(world, entity, CircleCollider) as CircleColliderData | null;
+ const circle = activeCollider(world, entity, CircleCollider2D) as CircleCollider2DData | null;
if (circle) {
return { kind: 'circle', r: circle.radius * ppu, ox: circle.offset.x * ppu, oy: circle.offset.y * ppu };
}
- const capsule = activeCollider(world, entity, CapsuleCollider) as CapsuleColliderData | null;
+ const capsule = activeCollider(world, entity, CapsuleCollider2D) as CapsuleCollider2DData | null;
if (capsule) {
return { kind: 'capsule', r: capsule.radius * ppu, halfH: capsule.halfHeight * ppu, ox: capsule.offset.x * ppu, oy: capsule.offset.y * ppu };
}
@@ -293,7 +293,7 @@ let warnedNonFiniteMove = false;
function warnNonFiniteMove(entity: Entity, ppu: number, dt: number): void {
if (warnedNonFiniteMove) return;
warnedNonFiniteMove = true;
- log.error('physics', `CharacterController move on entity ${entity} resolved to a non-finite pose `
+ log.error('physics', `CharacterController2D move on entity ${entity} resolved to a non-finite pose `
+ `(ppu=${ppu}, dt=${dt}); the Transform was left where it was. Check the entity's collider, `
+ 'velocity and the Canvas pixelsPerUnit.');
}
@@ -310,9 +310,9 @@ export function registerCharacterControllerSystem(app: App): void {
app.addSystemToSchedule(
Schedule.FixedUpdate,
defineSystem(
- [Query(Mut(CharacterController)), Res(Time), Res(Physics), GetWorld()],
+ [Query(Mut(CharacterController2D)), Res(Time), Res(Physics), GetWorld()],
(
- query: Iterable<[Entity, CharacterControllerData]>,
+ query: Iterable<[Entity, CharacterController2DData]>,
time: TimeData,
physics: PhysicsAPI,
world: World,
@@ -371,13 +371,13 @@ export function registerCharacterControllerSystem(app: App): void {
}
},
{
- name: 'CharacterControllerSystem',
+ name: 'CharacterController2DSystem',
runBefore: ['PhysicsStepSystem'],
// The World is how it reaches the collider (whichever of the three
// a character has) and the pose it resolves; the solver's contacts
// are physics-side state, not components.
touches: {
- reads: [BoxCollider._name, CircleCollider._name, CapsuleCollider._name],
+ reads: [BoxCollider2D._name, CircleCollider2D._name, CapsuleCollider2D._name],
writes: [Transform._name],
},
},
diff --git a/sdk/src/physics/ColliderShape.ts b/sdk/src/physics/ColliderShape.ts
index 20c55f861..a3a595ccf 100644
--- a/sdk/src/physics/ColliderShape.ts
+++ b/sdk/src/physics/ColliderShape.ts
@@ -16,12 +16,12 @@
import type { Vec2 } from '../types';
import type { World } from '../ecs/world';
import {
- BoxCollider, CircleCollider, CapsuleCollider,
- SegmentCollider, PolygonCollider, ChainCollider,
+ BoxCollider2D, CircleCollider2D, CapsuleCollider2D,
+ SegmentCollider2D, PolygonCollider2D, ChainCollider2D,
} from './PhysicsComponents';
import type {
- BoxColliderData, CircleColliderData, CapsuleColliderData,
- SegmentColliderData, PolygonColliderData, ChainColliderData,
+ BoxCollider2DData, CircleCollider2DData, CapsuleCollider2DData,
+ SegmentCollider2DData, PolygonCollider2DData, ChainCollider2DData,
} from './PhysicsComponents';
/** Semicircle-cap segment count for a capsule outline (matches the legacy debug draw). */
@@ -139,28 +139,28 @@ export function colliderShapeOutline(shape: ColliderShape, center: Vec2, angle:
export function readColliderShapes(world: World, entity: number): ColliderInstance[] {
const out: ColliderInstance[] = [];
const isEnabled = (c: { enabled?: boolean }): boolean => c.enabled !== false;
- if (world.has(entity, BoxCollider)) {
- const b = world.get(entity, BoxCollider) as BoxColliderData;
+ if (world.has(entity, BoxCollider2D)) {
+ const b = world.get(entity, BoxCollider2D) as BoxCollider2DData;
out.push({ shape: { kind: 'box', halfExtents: b.halfExtents, offset: b.offset }, isSensor: b.isSensor, enabled: isEnabled(b) });
}
- if (world.has(entity, CircleCollider)) {
- const c = world.get(entity, CircleCollider) as CircleColliderData;
+ if (world.has(entity, CircleCollider2D)) {
+ const c = world.get(entity, CircleCollider2D) as CircleCollider2DData;
out.push({ shape: { kind: 'circle', radius: c.radius, offset: c.offset }, isSensor: c.isSensor, enabled: isEnabled(c) });
}
- if (world.has(entity, CapsuleCollider)) {
- const c = world.get(entity, CapsuleCollider) as CapsuleColliderData;
+ if (world.has(entity, CapsuleCollider2D)) {
+ const c = world.get(entity, CapsuleCollider2D) as CapsuleCollider2DData;
out.push({ shape: { kind: 'capsule', radius: c.radius, halfHeight: c.halfHeight, offset: c.offset }, isSensor: c.isSensor, enabled: isEnabled(c) });
}
- if (world.has(entity, SegmentCollider)) {
- const s = world.get(entity, SegmentCollider) as SegmentColliderData;
+ if (world.has(entity, SegmentCollider2D)) {
+ const s = world.get(entity, SegmentCollider2D) as SegmentCollider2DData;
out.push({ shape: { kind: 'segment', point1: s.point1, point2: s.point2 }, isSensor: s.isSensor, enabled: isEnabled(s) });
}
- if (world.has(entity, PolygonCollider)) {
- const p = world.get(entity, PolygonCollider) as PolygonColliderData;
+ if (world.has(entity, PolygonCollider2D)) {
+ const p = world.get(entity, PolygonCollider2D) as PolygonCollider2DData;
out.push({ shape: { kind: 'polygon', vertices: p.vertices }, isSensor: p.isSensor, enabled: isEnabled(p) });
}
- if (world.has(entity, ChainCollider)) {
- const c = world.get(entity, ChainCollider) as ChainColliderData;
+ if (world.has(entity, ChainCollider2D)) {
+ const c = world.get(entity, ChainCollider2D) as ChainCollider2DData;
out.push({ shape: { kind: 'chain', points: c.points, isLoop: c.isLoop }, isSensor: false, enabled: isEnabled(c) });
}
return out;
diff --git a/sdk/src/physics/Physics.ts b/sdk/src/physics/Physics.ts
index 678f9e5d2..877219956 100644
--- a/sdk/src/physics/Physics.ts
+++ b/sdk/src/physics/Physics.ts
@@ -439,7 +439,7 @@ export class PhysicsAPI {
// ── Motor joint (runtime control) ───────────────────────────────────────
// `velocity` is world pixels/s (scaled to meters); force/torque are physics-space
- // (newtons, N·m). Targets a joint keyed by its owning entity (see MotorJoint).
+ // (newtons, N·m). Targets a joint keyed by its owning entity (see MotorJoint2D).
setMotorJointLinearVelocity(entity: Entity, velocity: Vec2, ppu = this.ppu_): void {
this.module_._physics_setMotorJointLinearVelocity(entity, velocity.x / ppu, velocity.y / ppu);
diff --git a/sdk/src/physics/PhysicsComponents.ts b/sdk/src/physics/PhysicsComponents.ts
index 7b1008421..a30f4560a 100644
--- a/sdk/src/physics/PhysicsComponents.ts
+++ b/sdk/src/physics/PhysicsComponents.ts
@@ -22,7 +22,7 @@ const COLLISION_FILTER_META = {
// Component Data Interfaces
// =============================================================================
-export interface RigidBodyData {
+export interface RigidBody2DData {
bodyType: number;
gravityScale: number;
linearDamping: number;
@@ -32,7 +32,7 @@ export interface RigidBodyData {
enabled: boolean;
}
-export interface BoxColliderData {
+export interface BoxCollider2DData {
halfExtents: Vec2;
offset: Vec2;
radius: number;
@@ -45,7 +45,7 @@ export interface BoxColliderData {
maskBits: number;
}
-export interface CircleColliderData {
+export interface CircleCollider2DData {
radius: number;
offset: Vec2;
density: number;
@@ -57,7 +57,7 @@ export interface CircleColliderData {
maskBits: number;
}
-export interface CapsuleColliderData {
+export interface CapsuleCollider2DData {
radius: number;
halfHeight: number;
offset: Vec2;
@@ -70,7 +70,7 @@ export interface CapsuleColliderData {
maskBits: number;
}
-export interface SegmentColliderData {
+export interface SegmentCollider2DData {
point1: Vec2;
point2: Vec2;
density: number;
@@ -82,7 +82,7 @@ export interface SegmentColliderData {
maskBits: number;
}
-export interface PolygonColliderData {
+export interface PolygonCollider2DData {
vertices: Vec2[];
radius: number;
density: number;
@@ -94,7 +94,7 @@ export interface PolygonColliderData {
maskBits: number;
}
-export interface ChainColliderData {
+export interface ChainCollider2DData {
points: Vec2[];
isLoop: boolean;
friction: number;
@@ -116,7 +116,7 @@ export { BodyType } from '../wasm/wasm.generated';
// Builtin Component Instances
// =============================================================================
-export const RigidBody = defineBuiltin<RigidBodyData>('RigidBody', {
+export const RigidBody2D = defineBuiltin<RigidBody2DData>('RigidBody2D', {
bodyType: 2,
gravityScale: 1.0,
linearDamping: 0.0,
@@ -134,7 +134,7 @@ export const RigidBody = defineBuiltin<RigidBodyData>('RigidBody', {
},
});
-export const BoxCollider = defineBuiltin<BoxColliderData>('BoxCollider', {
+export const BoxCollider2D = defineBuiltin<BoxCollider2DData>('BoxCollider2D', {
halfExtents: { x: 0.5, y: 0.5 },
offset: { x: 0, y: 0 },
radius: 0.05,
@@ -147,7 +147,7 @@ export const BoxCollider = defineBuiltin<BoxColliderData>('BoxCollider', {
maskBits: 0xFFFF,
}, { fields: { ...COLLISION_FILTER_META } });
-export const CircleCollider = defineBuiltin<CircleColliderData>('CircleCollider', {
+export const CircleCollider2D = defineBuiltin<CircleCollider2DData>('CircleCollider2D', {
radius: 0.5,
offset: { x: 0, y: 0 },
density: 1.0,
@@ -159,7 +159,7 @@ export const CircleCollider = defineBuiltin<CircleColliderData>('CircleCollider'
maskBits: 0xFFFF,
}, { fields: { ...COLLISION_FILTER_META } });
-export const CapsuleCollider = defineBuiltin<CapsuleColliderData>('CapsuleCollider', {
+export const CapsuleCollider2D = defineBuiltin<CapsuleCollider2DData>('CapsuleCollider2D', {
radius: 0.25,
halfHeight: 0.5,
offset: { x: 0, y: 0 },
@@ -172,7 +172,7 @@ export const CapsuleCollider = defineBuiltin<CapsuleColliderData>('CapsuleCollid
maskBits: 0xFFFF,
}, { fields: { ...COLLISION_FILTER_META } });
-export const SegmentCollider = defineBuiltin<SegmentColliderData>('SegmentCollider', {
+export const SegmentCollider2D = defineBuiltin<SegmentCollider2DData>('SegmentCollider2D', {
point1: { x: -0.5, y: 0 },
point2: { x: 0.5, y: 0 },
density: 1.0,
@@ -184,7 +184,7 @@ export const SegmentCollider = defineBuiltin<SegmentColliderData>('SegmentCollid
maskBits: 0xFFFF,
}, { fields: { ...COLLISION_FILTER_META } });
-export const PolygonCollider = defineComponent<PolygonColliderData>('PolygonCollider', {
+export const PolygonCollider2D = defineComponent<PolygonCollider2DData>('PolygonCollider2D', {
vertices: [
{ x: -0.5, y: -0.5 },
{ x: 0.5, y: -0.5 },
@@ -201,7 +201,7 @@ export const PolygonCollider = defineComponent<PolygonColliderData>('PolygonColl
maskBits: 0xFFFF,
}, { fields: { ...COLLISION_FILTER_META } });
-export const ChainCollider = defineComponent<ChainColliderData>('ChainCollider', {
+export const ChainCollider2D = defineComponent<ChainCollider2DData>('ChainCollider2D', {
points: [
{ x: -1, y: 0 },
{ x: 0, y: 0.5 },
@@ -238,7 +238,7 @@ export function activeCollider<C extends AnyComponentDef>(
// One-Way (One-Sided) Platform
// =============================================================================
-export interface OneWayPlatformData {
+export interface OneWayPlatform2DData {
// Solid-side normal in world/physics space. Contacts are cancelled unless the
// other body approaches from this side. Default {0,1} = solid top (land on top,
// jump up through it).
@@ -246,10 +246,10 @@ export interface OneWayPlatformData {
enabled: boolean;
}
-// A collider modifier: put it on an entity that also has a RigidBody + a collider.
+// A collider modifier: put it on an entity that also has a RigidBody2D + a collider.
// Consumed by PhysicsSystem, which enables Box2D pre-solve events on the entity's
// shapes and feeds the normal to the one-way pre-solve callback.
-export const OneWayPlatform = defineComponent<OneWayPlatformData>('OneWayPlatform', {
+export const OneWayPlatform2D = defineComponent<OneWayPlatform2DData>('OneWayPlatform2D', {
normal: { x: 0, y: 1 },
enabled: true,
});
@@ -258,7 +258,7 @@ export const OneWayPlatform = defineComponent<OneWayPlatformData>('OneWayPlatfor
// Joint Components
// =============================================================================
-export interface RevoluteJointData {
+export interface RevoluteJoint2DData {
connectedEntity: number;
anchorA: Vec2;
anchorB: Vec2;
@@ -272,7 +272,7 @@ export interface RevoluteJointData {
enabled: boolean;
}
-export const RevoluteJoint = defineComponent<RevoluteJointData>('RevoluteJoint', {
+export const RevoluteJoint2D = defineComponent<RevoluteJoint2DData>('RevoluteJoint2D', {
connectedEntity: -1,
anchorA: { x: 0, y: 0 },
anchorB: { x: 0, y: 0 },
@@ -286,7 +286,7 @@ export const RevoluteJoint = defineComponent<RevoluteJointData>('RevoluteJoint',
enabled: true,
}, { entityFields: ['connectedEntity'] });
-export interface DistanceJointData {
+export interface DistanceJoint2DData {
connectedEntity: number;
anchorA: Vec2;
anchorB: Vec2;
@@ -304,7 +304,7 @@ export interface DistanceJointData {
enabled: boolean;
}
-export const DistanceJoint = defineComponent<DistanceJointData>('DistanceJoint', {
+export const DistanceJoint2D = defineComponent<DistanceJoint2DData>('DistanceJoint2D', {
connectedEntity: -1,
anchorA: { x: 0, y: 0 },
anchorB: { x: 0, y: 0 },
@@ -322,7 +322,7 @@ export const DistanceJoint = defineComponent<DistanceJointData>('DistanceJoint',
enabled: true,
}, { entityFields: ['connectedEntity'] });
-export interface PrismaticJointData {
+export interface PrismaticJoint2DData {
connectedEntity: number;
anchorA: Vec2;
anchorB: Vec2;
@@ -340,7 +340,7 @@ export interface PrismaticJointData {
enabled: boolean;
}
-export const PrismaticJoint = defineComponent<PrismaticJointData>('PrismaticJoint', {
+export const PrismaticJoint2D = defineComponent<PrismaticJoint2DData>('PrismaticJoint2D', {
connectedEntity: -1,
anchorA: { x: 0, y: 0 },
anchorB: { x: 0, y: 0 },
@@ -358,7 +358,7 @@ export const PrismaticJoint = defineComponent<PrismaticJointData>('PrismaticJoin
enabled: true,
}, { entityFields: ['connectedEntity'] });
-export interface WeldJointData {
+export interface WeldJoint2DData {
connectedEntity: number;
anchorA: Vec2;
anchorB: Vec2;
@@ -370,7 +370,7 @@ export interface WeldJointData {
enabled: boolean;
}
-export const WeldJoint = defineComponent<WeldJointData>('WeldJoint', {
+export const WeldJoint2D = defineComponent<WeldJoint2DData>('WeldJoint2D', {
connectedEntity: -1,
anchorA: { x: 0, y: 0 },
anchorB: { x: 0, y: 0 },
@@ -382,7 +382,7 @@ export const WeldJoint = defineComponent<WeldJointData>('WeldJoint', {
enabled: true,
}, { entityFields: ['connectedEntity'] });
-export interface WheelJointData {
+export interface WheelJoint2DData {
connectedEntity: number;
anchorA: Vec2;
anchorB: Vec2;
@@ -400,7 +400,7 @@ export interface WheelJointData {
enabled: boolean;
}
-export const WheelJoint = defineComponent<WheelJointData>('WheelJoint', {
+export const WheelJoint2D = defineComponent<WheelJoint2DData>('WheelJoint2D', {
connectedEntity: -1,
anchorA: { x: 0, y: 0 },
anchorB: { x: 0, y: 0 },
@@ -418,7 +418,7 @@ export const WheelJoint = defineComponent<WheelJointData>('WheelJoint', {
enabled: true,
}, { entityFields: ['connectedEntity'] });
-export interface MotorJointData {
+export interface MotorJoint2DData {
connectedEntity: number;
// Target relative linear velocity (world units/s) and the max force to reach it.
linearVelocity: Vec2;
@@ -437,7 +437,7 @@ export interface MotorJointData {
enabled: boolean;
}
-export const MotorJoint = defineComponent<MotorJointData>('MotorJoint', {
+export const MotorJoint2D = defineComponent<MotorJoint2DData>('MotorJoint2D', {
connectedEntity: -1,
linearVelocity: { x: 0, y: 0 },
maxVelocityForce: 0,
diff --git a/sdk/src/physics/PhysicsDebugDraw.ts b/sdk/src/physics/PhysicsDebugDraw.ts
index 6cc678759..6b4cf7272 100644
--- a/sdk/src/physics/PhysicsDebugDraw.ts
+++ b/sdk/src/physics/PhysicsDebugDraw.ts
@@ -4,13 +4,13 @@ import type { App } from '../app/app';
import type { Color } from '../types';
import type { TransformData, CanvasData } from '../ecs/component';
import type { ResourceDef } from '../ecs/resource';
-import type { RigidBodyData } from './PhysicsComponents';
+import type { RigidBody2DData } from './PhysicsComponents';
import type { PhysicsEventsData } from './PhysicsPlugin';
import { Transform, Canvas } from '../ecs/component';
import { Draw } from '../render/draw';
import { defineResource } from '../ecs/resource';
import { registerDrawCallback } from '../render/customDraw';
-import { RigidBody, BodyType } from './PhysicsComponents';
+import { RigidBody2D, BodyType } from './PhysicsComponents';
import { readColliderShapes, shapeCenter, colliderShapeOutline } from './ColliderShape';
export interface PhysicsDebugDrawConfig {
@@ -100,7 +100,7 @@ export function drawPhysicsDebug(
if (!config || !config.enabled) return;
const ppu = readPixelsPerUnit(app);
- const entities = app.world.getEntitiesWithComponents([RigidBody, Transform]);
+ const entities = app.world.getEntitiesWithComponents([RigidBody2D, Transform]);
let physics: VelocityProvider | null = null;
if (config.showVelocity && app.hasResource(physicsApiRes)) {
@@ -108,7 +108,7 @@ export function drawPhysicsDebug(
}
for (const entity of entities) {
- const rb = app.world.get(entity, RigidBody) as RigidBodyData;
+ const rb = app.world.get(entity, RigidBody2D) as RigidBody2DData;
if (!rb.enabled) continue;
const wt = app.world.get(entity, Transform) as TransformData;
diff --git a/sdk/src/physics/PhysicsPlugin.ts b/sdk/src/physics/PhysicsPlugin.ts
index cd1365bbb..7a0a109de 100644
--- a/sdk/src/physics/PhysicsPlugin.ts
+++ b/sdk/src/physics/PhysicsPlugin.ts
@@ -22,7 +22,7 @@ import { PhysicsBridge } from './PhysicsBridge';
import { PhysicsRuntime } from './PhysicsRuntime';
import { PhysicsAPI, Physics } from './Physics';
import { registerPhysicsSystem } from './PhysicsSystem';
-import { registerCharacterControllerSystem } from './CharacterController';
+import { registerCharacterControllerSystem } from './CharacterController2D';
import { registerPhysicsEventBridge } from './PhysicsEventBridge';
import {
PhysicsEvents,
@@ -82,7 +82,7 @@ function resolveConfig(config: PhysicsPluginConfig): ResolvedPhysicsConfig {
* hours before the commit that added pose interpolation therefore installed
* happily, and `PhysicsStepSystem` and `PhysicsInterpolateSystem` then threw
* `_physics_capturePoses is not a function` TWICE A FRAME, for the length of
- * the session, at anyone who dropped a RigidBody into a scene and pressed Play.
+ * the session, at anyone who dropped a RigidBody2D into a scene and pressed Play.
* Two dogfood runs read that as "physics is broken" and turned it off.
*
* Not the whole interface — the per-frame contract, whose absence is the one
diff --git a/sdk/src/physics/PhysicsSystem.ts b/sdk/src/physics/PhysicsSystem.ts
index 8de545f9c..2ac39eef3 100644
--- a/sdk/src/physics/PhysicsSystem.ts
+++ b/sdk/src/physics/PhysicsSystem.ts
@@ -6,7 +6,7 @@
* step, transform readback, event collection.
*
* `registerPhysicsSystem` owns all closure state (tracked bodies, joint
- * cache, cached RigidBody props). `PhysicsPlugin.build()` calls it once
+ * cache, cached RigidBody2D props). `PhysicsPlugin.build()` calls it once
* the wasm module finishes loading.
*/
@@ -20,15 +20,15 @@ import { playModeOnly } from '../ecs/env';
import type { PhysicsWasmModule } from './PhysicsModuleLoader';
import { Physics } from './Physics';
import {
- RigidBody, BoxCollider, CircleCollider, CapsuleCollider,
- SegmentCollider, PolygonCollider, ChainCollider, OneWayPlatform,
- RevoluteJoint, DistanceJoint, PrismaticJoint, WeldJoint, WheelJoint, MotorJoint,
+ RigidBody2D, BoxCollider2D, CircleCollider2D, CapsuleCollider2D,
+ SegmentCollider2D, PolygonCollider2D, ChainCollider2D, OneWayPlatform2D,
+ RevoluteJoint2D, DistanceJoint2D, PrismaticJoint2D, WeldJoint2D, WheelJoint2D, MotorJoint2D,
BodyType, activeCollider,
- type RigidBodyData, type BoxColliderData, type CircleColliderData,
- type CapsuleColliderData, type SegmentColliderData, type PolygonColliderData,
- type ChainColliderData, type OneWayPlatformData, type RevoluteJointData,
- type DistanceJointData, type PrismaticJointData, type WeldJointData, type WheelJointData,
- type MotorJointData,
+ type RigidBody2DData, type BoxCollider2DData, type CircleCollider2DData,
+ type CapsuleCollider2DData, type SegmentCollider2DData, type PolygonCollider2DData,
+ type ChainCollider2DData, type OneWayPlatform2DData, type RevoluteJoint2DData,
+ type DistanceJoint2DData, type PrismaticJoint2DData, type WeldJoint2DData, type WheelJoint2DData,
+ type MotorJoint2DData,
} from './PhysicsComponents';
import {
PhysicsEvents,
@@ -96,7 +96,7 @@ function resolveCollisionMask(categoryBits: number, maskBits: number, layerMasks
export function addShapeForEntity(
world: App['world'], module: PhysicsWasmModule, entity: Entity, layerMasks?: number[],
): void {
- const box = activeCollider(world, entity, BoxCollider) as BoxColliderData | null;
+ const box = activeCollider(world, entity, BoxCollider2D) as BoxCollider2DData | null;
if (box) {
const category = box.categoryBits ?? 0x0001;
const mask = resolveCollisionMask(category, box.maskBits ?? 0xFFFF, layerMasks);
@@ -108,7 +108,7 @@ export function addShapeForEntity(
);
}
- const circle = activeCollider(world, entity, CircleCollider) as CircleColliderData | null;
+ const circle = activeCollider(world, entity, CircleCollider2D) as CircleCollider2DData | null;
if (circle) {
const category = circle.categoryBits ?? 0x0001;
const mask = resolveCollisionMask(category, circle.maskBits ?? 0xFFFF, layerMasks);
@@ -120,7 +120,7 @@ export function addShapeForEntity(
);
}
- const capsule = activeCollider(world, entity, CapsuleCollider) as CapsuleColliderData | null;
+ const capsule = activeCollider(world, entity, CapsuleCollider2D) as CapsuleCollider2DData | null;
if (capsule) {
const category = capsule.categoryBits ?? 0x0001;
const mask = resolveCollisionMask(category, capsule.maskBits ?? 0xFFFF, layerMasks);
@@ -132,7 +132,7 @@ export function addShapeForEntity(
);
}
- const seg = activeCollider(world, entity, SegmentCollider) as SegmentColliderData | null;
+ const seg = activeCollider(world, entity, SegmentCollider2D) as SegmentCollider2DData | null;
if (seg) {
const category = seg.categoryBits ?? 0x0001;
const mask = resolveCollisionMask(category, seg.maskBits ?? 0xFFFF, layerMasks);
@@ -143,7 +143,7 @@ export function addShapeForEntity(
);
}
- const poly = activeCollider(world, entity, PolygonCollider) as PolygonColliderData | null;
+ const poly = activeCollider(world, entity, PolygonCollider2D) as PolygonCollider2DData | null;
if (poly) {
const category = poly.categoryBits ?? 0x0001;
const mask = resolveCollisionMask(category, poly.maskBits ?? 0xFFFF, layerMasks);
@@ -164,7 +164,7 @@ export function addShapeForEntity(
});
}
- const chain = activeCollider(world, entity, ChainCollider) as ChainColliderData | null;
+ const chain = activeCollider(world, entity, ChainCollider2D) as ChainCollider2DData | null;
if (chain) {
const pts = chain.points;
if (pts.length < 4) return;
@@ -195,11 +195,11 @@ function createPendingJoints(
trackedJoints: Set<Entity>,
invPpu: number,
): void {
- const jointEntities = world.getEntitiesWithComponents([RevoluteJoint, RigidBody]);
+ const jointEntities = world.getEntitiesWithComponents([RevoluteJoint2D, RigidBody2D]);
for (const entity of jointEntities) {
if (trackedJoints.has(entity)) continue;
if (!trackedEntities.has(entity)) continue;
- const joint = world.get(entity, RevoluteJoint) as RevoluteJointData;
+ const joint = world.get(entity, RevoluteJoint2D) as RevoluteJoint2DData;
if (!joint.enabled) continue;
const connected = joint.connectedEntity as Entity;
if (!trackedEntities.has(connected)) continue;
@@ -214,10 +214,10 @@ function createPendingJoints(
trackedJoints.add(entity);
}
- for (const entity of world.getEntitiesWithComponents([DistanceJoint, RigidBody])) {
+ for (const entity of world.getEntitiesWithComponents([DistanceJoint2D, RigidBody2D])) {
if (trackedJoints.has(entity)) continue;
if (!trackedEntities.has(entity)) continue;
- const j = world.get(entity, DistanceJoint) as DistanceJointData;
+ const j = world.get(entity, DistanceJoint2D) as DistanceJoint2DData;
if (!j.enabled) continue;
const connected = j.connectedEntity as Entity;
if (!trackedEntities.has(connected)) continue;
@@ -234,10 +234,10 @@ function createPendingJoints(
trackedJoints.add(entity);
}
- for (const entity of world.getEntitiesWithComponents([PrismaticJoint, RigidBody])) {
+ for (const entity of world.getEntitiesWithComponents([PrismaticJoint2D, RigidBody2D])) {
if (trackedJoints.has(entity)) continue;
if (!trackedEntities.has(entity)) continue;
- const j = world.get(entity, PrismaticJoint) as PrismaticJointData;
+ const j = world.get(entity, PrismaticJoint2D) as PrismaticJoint2DData;
if (!j.enabled) continue;
const connected = j.connectedEntity as Entity;
if (!trackedEntities.has(connected)) continue;
@@ -254,10 +254,10 @@ function createPendingJoints(
trackedJoints.add(entity);
}
- for (const entity of world.getEntitiesWithComponents([WeldJoint, RigidBody])) {
+ for (const entity of world.getEntitiesWithComponents([WeldJoint2D, RigidBody2D])) {
if (trackedJoints.has(entity)) continue;
if (!trackedEntities.has(entity)) continue;
- const j = world.get(entity, WeldJoint) as WeldJointData;
+ const j = world.get(entity, WeldJoint2D) as WeldJoint2DData;
if (!j.enabled) continue;
const connected = j.connectedEntity as Entity;
if (!trackedEntities.has(connected)) continue;
@@ -272,10 +272,10 @@ function createPendingJoints(
trackedJoints.add(entity);
}
- for (const entity of world.getEntitiesWithComponents([WheelJoint, RigidBody])) {
+ for (const entity of world.getEntitiesWithComponents([WheelJoint2D, RigidBody2D])) {
if (trackedJoints.has(entity)) continue;
if (!trackedEntities.has(entity)) continue;
- const j = world.get(entity, WheelJoint) as WheelJointData;
+ const j = world.get(entity, WheelJoint2D) as WheelJoint2DData;
if (!j.enabled) continue;
const connected = j.connectedEntity as Entity;
if (!trackedEntities.has(connected)) continue;
@@ -292,10 +292,10 @@ function createPendingJoints(
trackedJoints.add(entity);
}
- for (const entity of world.getEntitiesWithComponents([MotorJoint, RigidBody])) {
+ for (const entity of world.getEntitiesWithComponents([MotorJoint2D, RigidBody2D])) {
if (trackedJoints.has(entity)) continue;
if (!trackedEntities.has(entity)) continue;
- const j = world.get(entity, MotorJoint) as MotorJointData;
+ const j = world.get(entity, MotorJoint2D) as MotorJoint2DData;
if (!j.enabled) continue;
const connected = j.connectedEntity as Entity;
if (!trackedEntities.has(connected)) continue;
@@ -326,9 +326,9 @@ function syncOneWayPlatforms(
trackedOneWay: Set<Entity>,
): void {
const seen = new Set<Entity>();
- for (const entity of world.getEntitiesWithComponents([OneWayPlatform, RigidBody])) {
+ for (const entity of world.getEntitiesWithComponents([OneWayPlatform2D, RigidBody2D])) {
if (!trackedEntities.has(entity)) continue;
- const ow = world.get(entity, OneWayPlatform) as OneWayPlatformData;
+ const ow = world.get(entity, OneWayPlatform2D) as OneWayPlatform2DData;
module._physics_setOneWayPlatform(entity, ow.normal.x, ow.normal.y, ow.enabled ? 1 : 0);
trackedOneWay.add(entity);
seen.add(entity);
@@ -609,7 +609,7 @@ interface CachedBodyProps {
angularDamping: number;
fixedRotation: boolean;
bullet: boolean;
- /** Last-applied RigidBody.enabled — drives in-place enable/disable. */
+ /** Last-applied RigidBody2D.enabled — drives in-place enable/disable. */
enabled: boolean;
/** Bitmask of present collider components — drives shape rebuild on change. */
colliderSig: number;
@@ -619,10 +619,10 @@ interface CachedBodyProps {
// in the per-entity collider signature (presence) — a change in the set, or any
// present collider's fields, triggers an in-place shape rebuild.
const COLLIDER_TYPES = [
- BoxCollider, CircleCollider, CapsuleCollider, SegmentCollider, PolygonCollider, ChainCollider,
+ BoxCollider2D, CircleCollider2D, CapsuleCollider2D, SegmentCollider2D, PolygonCollider2D, ChainCollider2D,
] as const;
-const JOINT_TYPES = [RevoluteJoint, DistanceJoint, PrismaticJoint, WeldJoint, WheelJoint, MotorJoint] as const;
+const JOINT_TYPES = [RevoluteJoint2D, DistanceJoint2D, PrismaticJoint2D, WeldJoint2D, WheelJoint2D, MotorJoint2D] as const;
/** Bitmask of which collider components an entity currently has. @internal */
export function colliderSignature(world: App['world'], entity: Entity): number {
@@ -656,7 +656,7 @@ export function jointChangedOrGone(world: App['world'], entity: Entity, sinceTic
/**
* For a tracked joint entity: whether its connected partner body is no longer
- * tracked (despawned, or its RigidBody removed). Box2D auto-destroys a joint
+ * tracked (despawned, or its RigidBody2D removed). Box2D auto-destroys a joint
* when either connected body dies, but the owner keeps its unchanged joint
* component and stays in `trackedJoints` — so without re-establishing it here the
* joint is silently dead forever, even after the partner respawns.
@@ -699,7 +699,7 @@ export function registerPhysicsSystem(
// state (no structural change + no physics-component edit). Kinematic bodies
// are driven by their Transform, so they're tracked separately and pushed every
// step regardless of whether the reconcile ran.
- const physicsComponents = [RigidBody, ...COLLIDER_TYPES, ...JOINT_TYPES, OneWayPlatform];
+ const physicsComponents = [RigidBody2D, ...COLLIDER_TYPES, ...JOINT_TYPES, OneWayPlatform2D];
for (const c of physicsComponents) app.world.enableChangeTracking(c);
const kinematicEntities = new Set<Entity>();
let lastStructuralVersion = -1;
@@ -761,7 +761,7 @@ export function registerPhysicsSystem(
}
}
if (needReconcile) {
- const entities = world.getEntitiesWithComponents([RigidBody, Transform]);
+ const entities = world.getEntitiesWithComponents([RigidBody2D, Transform]);
const currentEntities = new Set<Entity>();
// ── Unified body + collider reconcile ───────────────────────
@@ -771,7 +771,7 @@ export function registerPhysicsSystem(
// preserve simulation state — never destroy-and-rebuild.
for (const entity of entities) {
currentEntities.add(entity);
- const rb = world.get(entity, RigidBody) as RigidBodyData;
+ const rb = world.get(entity, RigidBody2D) as RigidBody2DData;
if (!trackedEntities.has(entity)) {
if (!rb.enabled) continue; // lazy-create on first enable
@@ -813,7 +813,7 @@ export function registerPhysicsSystem(
}
// 2. body properties.
- if (world.isChangedSince(entity, RigidBody, lastEntitySyncTick) &&
+ if (world.isChangedSince(entity, RigidBody2D, lastEntitySyncTick) &&
(cached.bodyType !== rb.bodyType ||
cached.gravityScale !== rb.gravityScale ||
cached.linearDamping !== rb.linearDamping ||
diff --git a/sdk/src/physics/index.ts b/sdk/src/physics/index.ts
index 881edf660..1eb35213f 100644
--- a/sdk/src/physics/index.ts
+++ b/sdk/src/physics/index.ts
@@ -42,35 +42,35 @@ export {
} from './PhysicsModuleLoader';
export {
- RigidBody,
- BoxCollider,
- CircleCollider,
- CapsuleCollider,
- SegmentCollider,
- PolygonCollider,
- ChainCollider,
- OneWayPlatform,
- RevoluteJoint,
- DistanceJoint,
- PrismaticJoint,
- WeldJoint,
- WheelJoint,
- MotorJoint,
+ RigidBody2D,
+ BoxCollider2D,
+ CircleCollider2D,
+ CapsuleCollider2D,
+ SegmentCollider2D,
+ PolygonCollider2D,
+ ChainCollider2D,
+ OneWayPlatform2D,
+ RevoluteJoint2D,
+ DistanceJoint2D,
+ PrismaticJoint2D,
+ WeldJoint2D,
+ WheelJoint2D,
+ MotorJoint2D,
BodyType,
- type RigidBodyData,
- type BoxColliderData,
- type CircleColliderData,
- type CapsuleColliderData,
- type SegmentColliderData,
- type PolygonColliderData,
- type ChainColliderData,
- type OneWayPlatformData,
- type RevoluteJointData,
- type DistanceJointData,
- type PrismaticJointData,
- type WeldJointData,
- type WheelJointData,
- type MotorJointData,
+ type RigidBody2DData,
+ type BoxCollider2DData,
+ type CircleCollider2DData,
+ type CapsuleCollider2DData,
+ type SegmentCollider2DData,
+ type PolygonCollider2DData,
+ type ChainCollider2DData,
+ type OneWayPlatform2DData,
+ type RevoluteJoint2DData,
+ type DistanceJoint2DData,
+ type PrismaticJoint2DData,
+ type WeldJoint2DData,
+ type WheelJoint2DData,
+ type MotorJoint2DData,
} from './PhysicsComponents';
export {
@@ -92,12 +92,12 @@ export {
} from './ColliderShape';
export {
- CharacterController,
+ CharacterController2D,
moveAndSlide,
registerCharacterControllerSystem,
- type CharacterControllerData,
+ type CharacterController2DData,
type MoveAndSlideParams,
type MoveAndSlideResult,
type SlideCast,
type SlideHit,
-} from './CharacterController';
+} from './CharacterController2D';
diff --git a/sdk/src/runtime/runtimeLoader.ts b/sdk/src/runtime/runtimeLoader.ts
index 87e451e31..e4db04c5d 100644
--- a/sdk/src/runtime/runtimeLoader.ts
+++ b/sdk/src/runtime/runtimeLoader.ts
@@ -210,8 +210,8 @@ export interface LoadRuntimeSceneOptions {
/** Component types whose presence means a scene needs the physics subsystem. */
const PHYSICS_COMPONENT_TYPES = new Set([
- 'RigidBody', 'BoxCollider', 'CircleCollider', 'CapsuleCollider',
- 'SegmentCollider', 'PolygonCollider', 'ChainCollider',
+ 'RigidBody2D', 'BoxCollider2D', 'CircleCollider2D', 'CapsuleCollider2D',
+ 'SegmentCollider2D', 'PolygonCollider2D', 'ChainCollider2D',
]);
/** The same question for the 3D world, which is a different module entirely. */
diff --git a/sdk/src/scene/legacyComponents.ts b/sdk/src/scene/legacyComponents.ts
index 16b277f60..0623092d3 100644
--- a/sdk/src/scene/legacyComponents.ts
+++ b/sdk/src/scene/legacyComponents.ts
@@ -43,6 +43,26 @@ export const RENAMED_COMPONENT_TYPES: ReadonlyMap<string, string> = new Map([
// models, PBR, IBL and shadow maps all went through them.
['Light2D', 'Light'],
['Mesh2D', 'MeshRenderer'],
+ // The other direction, and for the opposite reason: physics really does have
+ // two worlds, and the unsuffixed names were the FLAT one — so a collider
+ // dropped on a mesh was a flat box in a scene that is not flat.
+ ['RigidBody', 'RigidBody2D'],
+ ['BoxCollider', 'BoxCollider2D'],
+ ['CircleCollider', 'CircleCollider2D'],
+ ['CapsuleCollider', 'CapsuleCollider2D'],
+ ['SegmentCollider', 'SegmentCollider2D'],
+ ['PolygonCollider', 'PolygonCollider2D'],
+ ['ChainCollider', 'ChainCollider2D'],
+ ['CharacterController', 'CharacterController2D'],
+ ['OneWayPlatform', 'OneWayPlatform2D'],
+ // `DistanceJoint` and `DistanceJoint3D` differed by three characters and one
+ // solver; the rest of the flat set follows it rather than being half-named.
+ ['DistanceJoint', 'DistanceJoint2D'],
+ ['RevoluteJoint', 'RevoluteJoint2D'],
+ ['PrismaticJoint', 'PrismaticJoint2D'],
+ ['WeldJoint', 'WeldJoint2D'],
+ ['WheelJoint', 'WheelJoint2D'],
+ ['MotorJoint', 'MotorJoint2D'],
]);
/** Light kinds that aim: Directional (1) and Spot (3). Point and Ambient never did. */
diff --git a/sdk/src/scene/scene.ts b/sdk/src/scene/scene.ts
index 6591a0890..5f0d63d73 100644
--- a/sdk/src/scene/scene.ts
+++ b/sdk/src/scene/scene.ts
@@ -306,8 +306,12 @@ export async function expandScenePrefabs(
* from before the rename reads the new names as components it has never
* heard of and drops them, which is a scene that loads and has no lights —
* so it must refuse the file instead, and the version is what tells it to.
+ * 3: the flat physics components took the `2D` suffix the 3D ones already had
+ * (`RigidBody` → `RigidBody2D`, the four colliders, `CharacterController`).
+ * Same reasoning as 2, and worse here: an older engine drops the bodies and
+ * loads a level whose floor nothing collides with.
*/
-export const SCENE_FORMAT_VERSION = 2;
+export const SCENE_FORMAT_VERSION = 3;
export interface SceneMigrationResult {
/** A migrated *copy* — the input is never mutated. */
diff --git a/sdk/src/tilemap/tiledLoader.ts b/sdk/src/tilemap/tiledLoader.ts
index 094d04611..875f20ae6 100644
--- a/sdk/src/tilemap/tiledLoader.ts
+++ b/sdk/src/tilemap/tiledLoader.ts
@@ -37,7 +37,7 @@ function uploadTiledLayerTiles(entity: Entity, layer: TiledLayerData): void {
}
}
}
-import { RigidBody, BoxCollider, CircleCollider, PolygonCollider, ChainCollider, OneWayPlatform, BodyType } from '../physics/PhysicsComponents';
+import { RigidBody2D, BoxCollider2D, CircleCollider2D, PolygonCollider2D, ChainCollider2D, OneWayPlatform2D, BodyType } from '../physics/PhysicsComponents';
import type { ColliderShape } from '../physics/ColliderShape';
import type { ResolvedTileCollision } from './tilesetResolve';
import { mergeCollisionTiles } from './collisionMerge';
@@ -668,12 +668,12 @@ export function isCollisionObjectGroup(group: TiledObjectGroupData): boolean {
* object anchor (top-left for rects/ellipses, the vertex origin for polygons) — realized as
* the equivalent negative z-rotation on the collider entity, positioned at the true shape
* centre. Collider GEOMETRY is physics units (metres): pixel sizes divide by pixelsPerUnit,
- * matching `BoxCollider.halfExtents` semantics (positions stay pixels; physics scales those).
+ * matching `BoxCollider2D.halfExtents` semantics (positions stay pixels; physics scales those).
*
- * Shapes: rect → BoxCollider; ellipse → CircleCollider on the mean semi-axis (exact for
- * circles); polygon ≤ 8 vertices → PolygonCollider (Box2D's vertex cap); polygon > 8 →
- * bounding-box BoxCollider with a warning (predictably solid, never silently truncated);
- * polyline → open ChainCollider (the physics layer requires ≥ 4 points); point → skipped
+ * Shapes: rect → BoxCollider2D; ellipse → CircleCollider2D on the mean semi-axis (exact for
+ * circles); polygon ≤ 8 vertices → PolygonCollider2D (Box2D's vertex cap); polygon > 8 →
+ * bounding-box BoxCollider2D with a warning (predictably solid, never silently truncated);
+ * polyline → open ChainCollider2D (the physics layer requires ≥ 4 points); point → skipped
* (spawn/marker data, queryable from the parsed map).
*/
/**
@@ -696,9 +696,9 @@ function objectShapeTransform(
}
/**
- * The shape → collider decision shared by both Tiled object paths: rect → BoxCollider,
- * ellipse → CircleCollider on the mean semi-axis, polygon ≤ 8 verts → PolygonCollider
- * (> 8 → bounding-box Box, never silently truncated), polyline → open ChainCollider.
+ * The shape → collider decision shared by both Tiled object paths: rect → BoxCollider2D,
+ * ellipse → CircleCollider2D on the mean semi-axis, polygon ≤ 8 verts → PolygonCollider2D
+ * (> 8 → bounding-box Box, never silently truncated), polyline → open ChainCollider2D.
* `spawn(lx, ly)` positions AND assembles the entity at the shape centre in the caller's
* space — world-placed bare collider vs parented Marker region — so only the collider
* geometry (metres = pixels ÷ ppu) lives here. Returns the entity, or null when the shape
@@ -711,7 +711,7 @@ function attachObjectShape(
): Entity | null {
if (obj.shape === 'rect') {
const e = spawn(obj.width * 0.5, obj.height * 0.5);
- world.insert(e, BoxCollider, {
+ world.insert(e, BoxCollider2D, {
halfExtents: { x: obj.width * 0.5 / pixelsPerUnit, y: obj.height * 0.5 / pixelsPerUnit },
isSensor: sensor,
});
@@ -719,7 +719,7 @@ function attachObjectShape(
}
if (obj.shape === 'ellipse') {
const e = spawn(obj.width * 0.5, obj.height * 0.5);
- world.insert(e, CircleCollider, { radius: (obj.width + obj.height) * 0.25 / pixelsPerUnit, isSensor: sensor });
+ world.insert(e, CircleCollider2D, { radius: (obj.width + obj.height) * 0.25 / pixelsPerUnit, isSensor: sensor });
return e;
}
if (!obj.vertices || obj.vertices.length < 4) return null;
@@ -732,13 +732,13 @@ function attachObjectShape(
if (obj.shape === 'polyline') {
if (sensor) return null;
const e = spawn(0, 0);
- world.insert(e, ChainCollider, { points: local, isLoop: false });
+ world.insert(e, ChainCollider2D, { points: local, isLoop: false });
return e;
}
if (local.length < 3) return null; // a polygon needs at least a triangle
if (local.length <= 8) {
const e = spawn(0, 0);
- world.insert(e, PolygonCollider, { vertices: local, isSensor: sensor });
+ world.insert(e, PolygonCollider2D, { vertices: local, isSensor: sensor });
return e;
}
log.warn('tilemap', `object polygon in group '${groupName}' has ${local.length} vertices (Box2D max 8); using its bounding box`);
@@ -751,7 +751,7 @@ function attachObjectShape(
if (vy > maxY) maxY = vy;
}
const e = spawn((minX + maxX) * 0.5, (minY + maxY) * 0.5);
- world.insert(e, BoxCollider, {
+ world.insert(e, BoxCollider2D, {
halfExtents: { x: (maxX - minX) * 0.5 / pixelsPerUnit, y: (maxY - minY) * 0.5 / pixelsPerUnit },
isSensor: sensor,
});
@@ -773,7 +773,7 @@ export function generateObjectCollision(
const entity = world.spawn();
const { position, rotation } = objectShapeTransform(obj, originX, originY, lx, ly);
world.insert(entity, Transform, rotation ? { position, rotation } : { position });
- world.insert(entity, RigidBody, { bodyType: BodyType.Static });
+ world.insert(entity, RigidBody2D, { bodyType: BodyType.Static });
return entity;
});
if (e) entities.push(e);
@@ -792,7 +792,7 @@ function objectPropsRecord(obj: TiledObjectData): Record<string, string> {
/**
* @brief Project ONE Tiled SHAPE object (rect / ellipse / polygon / polyline) into a real
* REGION entity — the same shape a hand-authored Trigger Area preset builds:
- * Transform + Marker{type,properties} + static RigidBody + a collider matching the
+ * Transform + Marker{type,properties} + static RigidBody2D + a collider matching the
* shape. `sensor` picks the flavour: a non-collision group's regions are SENSORS
* (trigger zones), a `collision` group's regions are SOLID geometry (walls/floors) —
* one derivation for both, so every shape object becomes a queryable, gizmo-visible
@@ -818,7 +818,7 @@ export function spawnObjectRegion(
const { position, rotation } = objectShapeTransform(obj, 0, 0, lx, ly);
world.insert(e, Transform, rotation ? { position, rotation } : { position });
world.insert(e, Marker, { type: obj.type || '', properties: objectPropsRecord(obj) });
- world.insert(e, RigidBody, { bodyType: BodyType.Static });
+ world.insert(e, RigidBody2D, { bodyType: BodyType.Static });
world.insert(e, RuntimeOnly, {});
world.setParent(e, parent);
return e;
@@ -849,7 +849,7 @@ export function loadTiledCollisionObjects(
* Grid-agnostic core shared by the Tiled-import (`generateTileCollision`) and the runtime
* asset (`TilemapSyncSystem`) paths. Row 0 (top of the grid) maps to the highest world-Y
* and rows descend (y-down), matching the renderer; each merged rect becomes one static
- * `BoxCollider` body placed relative to (originX, originY) — the tilemap entity's origin.
+ * `BoxCollider2D` body placed relative to (originX, originY) — the tilemap entity's origin.
*/
export function generateLayerCollision(
world: World,
@@ -880,11 +880,11 @@ export function generateLayerCollision(
world.insert(entity, Transform, {
position: { x: worldX, y: worldY, z: 0 },
});
- world.insert(entity, RigidBody, { bodyType: BodyType.Static });
+ world.insert(entity, RigidBody2D, { bodyType: BodyType.Static });
// Position is in pixels (physics scales it by pixelsPerUnit); halfExtents are
// PHYSICS units (metres), so divide the pixel size — otherwise a tile collider
// is pixelsPerUnit× too big (the default 100 → 100× oversized).
- world.insert(entity, BoxCollider, {
+ world.insert(entity, BoxCollider2D, {
halfExtents: { x: mergedW * 0.5 / pixelsPerUnit, y: mergedH * 0.5 / pixelsPerUnit },
});
entities.push(entity);
@@ -945,9 +945,9 @@ export function generateChunkCollision(
z: 0,
},
});
- world.insert(entity, RigidBody, { bodyType: BodyType.Static });
+ world.insert(entity, RigidBody2D, { bodyType: BodyType.Static });
// halfExtents in physics units (metres); divide the pixel size by ppu.
- world.insert(entity, BoxCollider, {
+ world.insert(entity, BoxCollider2D, {
halfExtents: { x: rect.width * tileW * 0.5 / pixelsPerUnit, y: rect.height * tileH * 0.5 / pixelsPerUnit },
});
entities.push(entity);
@@ -1010,7 +1010,7 @@ export function tileColliderShape(
}
/**
- * Spawn one static PolygonCollider per placed tile whose global id has a polygon shape
+ * Spawn one static PolygonCollider2D per placed tile whose global id has a polygon shape
* (slopes / partial tiles). Box-shaped tiles are handled by {@link generateChunkCollision};
* the two run together. Flip flags on a cell flip its polygon to match the render.
*/
@@ -1041,10 +1041,10 @@ export function generateChunkPolygonCollision(
world.insert(entity, Transform, {
position: { x: originX + (gx + 0.5) * tileW, y: originY - (gy + 0.5) * tileH, z: 0 },
});
- world.insert(entity, RigidBody, { bodyType: BodyType.Static });
- // PolygonCollider vertices are physics units (uploaded unscaled, like
- // BoxCollider.halfExtents) — divide the pixel-space outline by ppu.
- world.insert(entity, PolygonCollider, {
+ world.insert(entity, RigidBody2D, { bodyType: BodyType.Static });
+ // PolygonCollider2D vertices are physics units (uploaded unscaled, like
+ // BoxCollider2D.halfExtents) — divide the pixel-space outline by ppu.
+ world.insert(entity, PolygonCollider2D, {
vertices: polygonLocalVerts(shape, tileW, tileH, f.flipH, f.flipV, f.flipD)
.map((v) => ({ x: v.x / pixelsPerUnit, y: v.y / pixelsPerUnit })),
});
@@ -1088,7 +1088,7 @@ function spawnTileShape(
world.insert(entity, Transform, {
position: { x: originX + (gx + 0.5) * tileW, y: originY - (gy + 0.5) * tileH, z: 0 },
});
- world.insert(entity, RigidBody, { bodyType: BodyType.Static });
+ world.insert(entity, RigidBody2D, { bodyType: BodyType.Static });
// Only the material/sensor fields the tile overrode; the rest keep component defaults.
const mat: { density?: number; friction?: number; restitution?: number; isSensor?: boolean } = {};
@@ -1102,25 +1102,25 @@ function spawnTileShape(
// overlay draws, so what you see out of Play is what spawns.
const shape = tileColliderShape(rc, tileW, tileH, f.flipH, f.flipV, f.flipD);
if (shape.kind === 'polygon') {
- world.insert(entity, PolygonCollider, {
+ world.insert(entity, PolygonCollider2D, {
vertices: shape.vertices.map((v) => ({ x: v.x / ppu, y: v.y / ppu })),
...mat,
});
} else if (shape.kind === 'circle') {
- world.insert(entity, CircleCollider, {
+ world.insert(entity, CircleCollider2D, {
radius: shape.radius / ppu,
offset: { x: shape.offset.x / ppu, y: shape.offset.y / ppu },
...mat,
});
} else if (shape.kind === 'box') {
- world.insert(entity, BoxCollider, {
+ world.insert(entity, BoxCollider2D, {
halfExtents: { x: shape.halfExtents.x / ppu, y: shape.halfExtents.y / ppu },
...mat,
});
}
if (rc.oneWay) {
- world.insert(entity, OneWayPlatform, {
+ world.insert(entity, OneWayPlatform2D, {
normal: oneWayNormalWorld(rc.oneWay.nx, rc.oneWay.ny, f.flipH, f.flipV, f.flipD),
});
}
diff --git a/sdk/src/velocity.ts b/sdk/src/velocity.ts
index 93900edde..792aa0c4b 100644
--- a/sdk/src/velocity.ts
+++ b/sdk/src/velocity.ts
@@ -24,10 +24,10 @@ export const velocitySystem = defineSystem(
const dt = time.delta;
if (dt <= 0) return;
// Physics-owned bodies get their transform from the solver; integrating
- // Velocity on top would double-move them. RigidBody lives in the physics
+ // Velocity on top would double-move them. RigidBody2D lives in the physics
// subpath, so it is resolved by name — absent registry entry means the
// physics module was never loaded and no entity can carry it.
- const rigidBody = getComponentRegistry().get('RigidBody');
+ const rigidBody = getComponentRegistry().get('RigidBody2D');
for (const [entity, transform, velocity] of query) {
if (rigidBody && world.has(entity, rigidBody)) continue;
@@ -63,9 +63,9 @@ export const velocitySystem = defineSystem(
{
name: 'VelocitySystem',
// The World is here for one question — does this entity have a physics
- // body — and RigidBody cannot be named as a query filter because the
+ // body — and RigidBody2D cannot be named as a query filter because the
// physics module may never have registered it.
- touches: { reads: ['RigidBody'] },
+ touches: { reads: ['RigidBody2D'] },
}
);
diff --git a/sdk/src/wasm/ptrLayouts.generated.ts b/sdk/src/wasm/ptrLayouts.generated.ts
index 4510aa6c9..6edcf426a 100644
--- a/sdk/src/wasm/ptrLayouts.generated.ts
+++ b/sdk/src/wasm/ptrLayouts.generated.ts
@@ -40,8 +40,8 @@ export const PTR_LAYOUTS: Record<string, PtrLayout> = {
{ name: 'enabled', type: 'bool', offset: 56 },
],
},
- BoxCollider: {
- ptrFn: 'getBoxColliderPtr',
+ BoxCollider2D: {
+ ptrFn: 'getBoxCollider2DPtr',
fields: [
{ name: 'halfExtents', type: 'vec2', offset: 0 },
{ name: 'offset', type: 'vec2', offset: 8 },
@@ -93,8 +93,8 @@ export const PTR_LAYOUTS: Record<string, PtrLayout> = {
{ name: 'layer', type: 'i32', offset: 36 },
],
},
- CapsuleCollider: {
- ptrFn: 'getCapsuleColliderPtr',
+ CapsuleCollider2D: {
+ ptrFn: 'getCapsuleCollider2DPtr',
fields: [
{ name: 'radius', type: 'f32', offset: 0 },
{ name: 'halfHeight', type: 'f32', offset: 4 },
@@ -137,8 +137,8 @@ export const PTR_LAYOUTS: Record<string, PtrLayout> = {
{ name: 'realVelocity', type: 'vec3', offset: 64 },
],
},
- CircleCollider: {
- ptrFn: 'getCircleColliderPtr',
+ CircleCollider2D: {
+ ptrFn: 'getCircleCollider2DPtr',
fields: [
{ name: 'radius', type: 'f32', offset: 0 },
{ name: 'offset', type: 'vec2', offset: 4 },
@@ -329,8 +329,8 @@ export const PTR_LAYOUTS: Record<string, PtrLayout> = {
{ name: 'enabled', type: 'bool', offset: 25 },
],
},
- RigidBody: {
- ptrFn: 'getRigidBodyPtr',
+ RigidBody2D: {
+ ptrFn: 'getRigidBody2DPtr',
fields: [
{ name: 'bodyType', type: 'u8', offset: 0 },
{ name: 'gravityScale', type: 'f32', offset: 4 },
@@ -354,8 +354,8 @@ export const PTR_LAYOUTS: Record<string, PtrLayout> = {
{ name: 'enabled', type: 'bool', offset: 25 },
],
},
- SegmentCollider: {
- ptrFn: 'getSegmentColliderPtr',
+ SegmentCollider2D: {
+ ptrFn: 'getSegmentCollider2DPtr',
fields: [
{ name: 'point1', type: 'vec2', offset: 0 },
{ name: 'point2', type: 'vec2', offset: 8 },
diff --git a/sdk/src/wasm/wasm.generated.ts b/sdk/src/wasm/wasm.generated.ts
index aafcfce58..c0827192f 100644
--- a/sdk/src/wasm/wasm.generated.ts
+++ b/sdk/src/wasm/wasm.generated.ts
@@ -230,7 +230,7 @@ export interface BitmapText {
enabled: boolean;
}
-export interface BoxCollider {
+export interface BoxCollider2D {
halfExtents: Vec2;
offset: Vec2;
density: number;
@@ -275,7 +275,7 @@ export interface Canvas {
layer: number;
}
-export interface CapsuleCollider {
+export interface CapsuleCollider2D {
radius: number;
halfHeight: number;
offset: Vec2;
@@ -317,7 +317,7 @@ export interface Children {
entities: VectorEntity;
}
-export interface CircleCollider {
+export interface CircleCollider2D {
radius: number;
offset: Vec2;
density: number;
@@ -499,7 +499,7 @@ export interface ParticleForceField {
enabled: boolean;
}
-export interface RigidBody {
+export interface RigidBody2D {
bodyType: number;
gravityScale: number;
linearDamping: number;
@@ -520,7 +520,7 @@ export interface RigidBody3D {
enabled: boolean;
}
-export interface SegmentCollider {
+export interface SegmentCollider2D {
point1: Vec2;
point2: Vec2;
density: number;
@@ -711,10 +711,10 @@ export interface Registry {
getBitmapText(entity: Entity): BitmapText;
addBitmapText(entity: Entity, component: BitmapText): void;
removeBitmapText(entity: Entity): void;
- hasBoxCollider(entity: Entity): boolean;
- getBoxCollider(entity: Entity): BoxCollider;
- addBoxCollider(entity: Entity, component: BoxCollider): void;
- removeBoxCollider(entity: Entity): void;
+ hasBoxCollider2D(entity: Entity): boolean;
+ getBoxCollider2D(entity: Entity): BoxCollider2D;
+ addBoxCollider2D(entity: Entity, component: BoxCollider2D): void;
+ removeBoxCollider2D(entity: Entity): void;
hasBoxCollider3D(entity: Entity): boolean;
getBoxCollider3D(entity: Entity): BoxCollider3D;
addBoxCollider3D(entity: Entity, component: BoxCollider3D): void;
@@ -727,10 +727,10 @@ export interface Registry {
getCanvas(entity: Entity): Canvas;
addCanvas(entity: Entity, component: Canvas): void;
removeCanvas(entity: Entity): void;
- hasCapsuleCollider(entity: Entity): boolean;
- getCapsuleCollider(entity: Entity): CapsuleCollider;
- addCapsuleCollider(entity: Entity, component: CapsuleCollider): void;
- removeCapsuleCollider(entity: Entity): void;
+ hasCapsuleCollider2D(entity: Entity): boolean;
+ getCapsuleCollider2D(entity: Entity): CapsuleCollider2D;
+ addCapsuleCollider2D(entity: Entity, component: CapsuleCollider2D): void;
+ removeCapsuleCollider2D(entity: Entity): void;
hasCapsuleCollider3D(entity: Entity): boolean;
getCapsuleCollider3D(entity: Entity): CapsuleCollider3D;
addCapsuleCollider3D(entity: Entity, component: CapsuleCollider3D): void;
@@ -743,10 +743,10 @@ export interface Registry {
getChildren(entity: Entity): Children;
addChildren(entity: Entity, component: Children): void;
removeChildren(entity: Entity): void;
- hasCircleCollider(entity: Entity): boolean;
- getCircleCollider(entity: Entity): CircleCollider;
- addCircleCollider(entity: Entity, component: CircleCollider): void;
- removeCircleCollider(entity: Entity): void;
+ hasCircleCollider2D(entity: Entity): boolean;
+ getCircleCollider2D(entity: Entity): CircleCollider2D;
+ addCircleCollider2D(entity: Entity, component: CircleCollider2D): void;
+ removeCircleCollider2D(entity: Entity): void;
hasConvexCollider3D(entity: Entity): boolean;
getConvexCollider3D(entity: Entity): ConvexCollider3D;
addConvexCollider3D(entity: Entity, component: ConvexCollider3D): void;
@@ -795,18 +795,18 @@ export interface Registry {
getParticleForceField(entity: Entity): ParticleForceField;
addParticleForceField(entity: Entity, component: ParticleForceField): void;
removeParticleForceField(entity: Entity): void;
- hasRigidBody(entity: Entity): boolean;
- getRigidBody(entity: Entity): RigidBody;
- addRigidBody(entity: Entity, component: RigidBody): void;
- removeRigidBody(entity: Entity): void;
+ hasRigidBody2D(entity: Entity): boolean;
+ getRigidBody2D(entity: Entity): RigidBody2D;
+ addRigidBody2D(entity: Entity, component: RigidBody2D): void;
+ removeRigidBody2D(entity: Entity): void;
hasRigidBody3D(entity: Entity): boolean;
getRigidBody3D(entity: Entity): RigidBody3D;
addRigidBody3D(entity: Entity, component: RigidBody3D): void;
removeRigidBody3D(entity: Entity): void;
- hasSegmentCollider(entity: Entity): boolean;
- getSegmentCollider(entity: Entity): SegmentCollider;
- addSegmentCollider(entity: Entity, component: SegmentCollider): void;
- removeSegmentCollider(entity: Entity): void;
+ hasSegmentCollider2D(entity: Entity): boolean;
+ getSegmentCollider2D(entity: Entity): SegmentCollider2D;
+ addSegmentCollider2D(entity: Entity, component: SegmentCollider2D): void;
+ removeSegmentCollider2D(entity: Entity): void;
hasShadowCaster2D(entity: Entity): boolean;
getShadowCaster2D(entity: Entity): ShadowCaster2D;
addShadowCaster2D(entity: Entity, component: ShadowCaster2D): void;
@@ -878,15 +878,15 @@ export interface ESEngineModule {
*/
getBuiltinComponentNames(): string[];
BitmapText: new () => BitmapText;
- BoxCollider: new () => BoxCollider;
+ BoxCollider2D: new () => BoxCollider2D;
BoxCollider3D: new () => BoxCollider3D;
Camera: new () => Camera;
Canvas: new () => Canvas;
- CapsuleCollider: new () => CapsuleCollider;
+ CapsuleCollider2D: new () => CapsuleCollider2D;
CapsuleCollider3D: new () => CapsuleCollider3D;
CharacterController3D: new () => CharacterController3D;
Children: new () => Children;
- CircleCollider: new () => CircleCollider;
+ CircleCollider2D: new () => CircleCollider2D;
ConvexCollider3D: new () => ConvexCollider3D;
Draggable: new () => Draggable;
DragonBonesAnimation: new () => DragonBonesAnimation;
@@ -899,9 +899,9 @@ export interface ESEngineModule {
Parent: new () => Parent;
ParticleEmitter: new () => ParticleEmitter;
ParticleForceField: new () => ParticleForceField;
- RigidBody: new () => RigidBody;
+ RigidBody2D: new () => RigidBody2D;
RigidBody3D: new () => RigidBody3D;
- SegmentCollider: new () => SegmentCollider;
+ SegmentCollider2D: new () => SegmentCollider2D;
ShadowCaster2D: new () => ShadowCaster2D;
ShapeRenderer: new () => ShapeRenderer;
SphereCollider3D: new () => SphereCollider3D;
diff --git a/sdk/tests/character-controller.test.ts b/sdk/tests/character-controller.test.ts
index 5e5fc60ca..d4b45754d 100644
--- a/sdk/tests/character-controller.test.ts
+++ b/sdk/tests/character-controller.test.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
import { describe, it, expect } from 'vitest';
-import { moveAndSlide, type SlideCast, type MoveAndSlideParams } from '../src/physics/CharacterController';
+import { moveAndSlide, type SlideCast, type MoveAndSlideParams } from '../src/physics/CharacterController2D';
const close = (a: number, b: number, eps = 1e-6) => expect(Math.abs(a - b)).toBeLessThanOrEqual(eps);
diff --git a/sdk/tests/chunk-collision.test.ts b/sdk/tests/chunk-collision.test.ts
index f0a0c3a75..ab457872d 100644
--- a/sdk/tests/chunk-collision.test.ts
+++ b/sdk/tests/chunk-collision.test.ts
@@ -29,7 +29,7 @@ function encodeChunks(chunks: { x: number; y: number; tiles: Uint16Array }[]): s
return btoa(bin).replace(/\+/g, '-').replace(/\//g, '_');
}
-interface MockEntity { Transform?: any; RigidBody?: any; BoxCollider?: any }
+interface MockEntity { Transform?: any; RigidBody2D?: any; BoxCollider2D?: any }
function createMockWorld(): { world: World; store: Map<number, MockEntity> } {
let nextId = 1;
const store = new Map<number, MockEntity>();
@@ -68,8 +68,8 @@ describe('generateChunkCollision', () => {
const e = store.get(ents[0])!;
// x0..x1 = 0..1, y0..y1 = 0..0 → center ((0+1+1)/2·16, -(0+0+1)/2·16) = (16, -8)
expect(e.Transform.position).toEqual({ x: 16, y: -8, z: 0 });
- expect(e.BoxCollider.halfExtents).toEqual({ x: 16, y: 8 });
- expect(e.RigidBody.bodyType).toBe(BodyType.Static);
+ expect(e.BoxCollider2D.halfExtents).toEqual({ x: 16, y: 8 });
+ expect(e.RigidBody2D.bodyType).toBe(BodyType.Static);
});
it('offsets by chunk coords and the tilemap world origin', () => {
diff --git a/sdk/tests/colliderEnabled.test.ts b/sdk/tests/colliderEnabled.test.ts
index 079d3d136..21d75e0ea 100644
--- a/sdk/tests/colliderEnabled.test.ts
+++ b/sdk/tests/colliderEnabled.test.ts
@@ -12,8 +12,8 @@ import { describe, it, expect } from 'vitest';
import { World } from '../src/ecs/world';
import { createMockModule } from './mocks/wasm';
import {
- BoxCollider, CircleCollider, CapsuleCollider,
- SegmentCollider, PolygonCollider, ChainCollider,
+ BoxCollider2D, CircleCollider2D, CapsuleCollider2D,
+ SegmentCollider2D, PolygonCollider2D, ChainCollider2D,
} from '../src/physics/PhysicsComponents';
import { addShapeForEntity, collidersChangedSince } from '../src/physics/PhysicsSystem';
import { readColliderShapes } from '../src/physics/ColliderShape';
@@ -45,12 +45,12 @@ function recordingModule(): { shapes: string[]; module: PhysicsWasmModule } {
}
const COLLIDERS = [
- { name: 'box', component: BoxCollider },
- { name: 'circle', component: CircleCollider },
- { name: 'capsule', component: CapsuleCollider },
- { name: 'segment', component: SegmentCollider },
- { name: 'polygon', component: PolygonCollider },
- { name: 'chain', component: ChainCollider },
+ { name: 'box', component: BoxCollider2D },
+ { name: 'circle', component: CircleCollider2D },
+ { name: 'capsule', component: CapsuleCollider2D },
+ { name: 'segment', component: SegmentCollider2D },
+ { name: 'polygon', component: PolygonCollider2D },
+ { name: 'chain', component: ChainCollider2D },
] as const;
describe('addShapeForEntity honours collider.enabled', () => {
@@ -78,8 +78,8 @@ describe('addShapeForEntity honours collider.enabled', () => {
const world = testWorld();
const { shapes, module } = recordingModule();
const e = world.spawn();
- world.insert(e, BoxCollider, { enabled: false } as never);
- world.insert(e, CircleCollider, {} as never);
+ world.insert(e, BoxCollider2D, { enabled: false } as never);
+ world.insert(e, CircleCollider2D, {} as never);
addShapeForEntity(world, module, e);
expect(shapes).toEqual(['circle']);
});
@@ -88,10 +88,10 @@ describe('addShapeForEntity honours collider.enabled', () => {
const world = testWorld();
const { shapes, module } = recordingModule();
const e = world.spawn();
- world.insert(e, BoxCollider, {} as never);
- const legacy = { ...world.get(e, BoxCollider) } as Record<string, unknown>;
+ world.insert(e, BoxCollider2D, {} as never);
+ const legacy = { ...world.get(e, BoxCollider2D) } as Record<string, unknown>;
delete legacy.enabled;
- world.set(e, BoxCollider, legacy as never);
+ world.set(e, BoxCollider2D, legacy as never);
addShapeForEntity(world, module, e);
expect(shapes).toEqual(['box']);
});
@@ -101,8 +101,8 @@ describe('the rest of the engine agrees with the shape that is there', () => {
it('reports the flag to the visualizers, so the debug overlay can skip it', () => {
const world = testWorld();
const e = world.spawn();
- world.insert(e, BoxCollider, { enabled: false } as never);
- world.insert(e, CircleCollider, {} as never);
+ world.insert(e, BoxCollider2D, { enabled: false } as never);
+ world.insert(e, CircleCollider2D, {} as never);
const [box, circle] = readColliderShapes(world, e);
expect(box.enabled).toBe(false);
expect(circle.enabled).toBe(true);
@@ -110,14 +110,14 @@ describe('the rest of the engine agrees with the shape that is there', () => {
it('marks the collider changed when the flag flips, which is what rebuilds the shapes', () => {
const world = testWorld();
- world.enableChangeTracking(BoxCollider); // registerPhysicsSystem does this
+ world.enableChangeTracking(BoxCollider2D); // registerPhysicsSystem does this
const e = world.spawn();
- world.insert(e, BoxCollider, {} as never);
+ world.insert(e, BoxCollider2D, {} as never);
const settled = world.getWorldTick();
expect(collidersChangedSince(world, e, settled)).toBe(false);
world.advanceTick(); // next frame: the game turns the platform off
- world.set(e, BoxCollider, { ...world.get(e, BoxCollider), enabled: false });
+ world.set(e, BoxCollider2D, { ...world.get(e, BoxCollider2D), enabled: false });
expect(collidersChangedSince(world, e, settled)).toBe(true);
});
});
diff --git a/sdk/tests/collisionLayerMask.test.ts b/sdk/tests/collisionLayerMask.test.ts
index 8e80f2f8d..e2b6acaa0 100644
--- a/sdk/tests/collisionLayerMask.test.ts
+++ b/sdk/tests/collisionLayerMask.test.ts
@@ -7,7 +7,7 @@
import { describe, it, expect } from 'vitest';
import { World } from '../src/ecs/world';
import { createMockModule } from './mocks/wasm';
-import { BoxCollider } from '../src/physics/PhysicsComponents';
+import { BoxCollider2D } from '../src/physics/PhysicsComponents';
import { addShapeForEntity } from '../src/physics/PhysicsSystem';
import type { PhysicsWasmModule } from '../src/physics/PhysicsModuleLoader';
@@ -36,7 +36,7 @@ function boxOnLayer(layer: number, maskBits: number, layerMasks?: number[]) {
const world = testWorld();
const { filters, module } = maskRecorder();
const e = world.spawn();
- world.insert(e, BoxCollider, { categoryBits: 1 << layer, maskBits } as never);
+ world.insert(e, BoxCollider2D, { categoryBits: 1 << layer, maskBits } as never);
addShapeForEntity(world, module, e, layerMasks);
return filters[0];
}
diff --git a/sdk/tests/component-rename-upgrade.test.ts b/sdk/tests/component-rename-upgrade.test.ts
index a82ce9985..a915ef572 100644
--- a/sdk/tests/component-rename-upgrade.test.ts
+++ b/sdk/tests/component-rename-upgrade.test.ts
@@ -72,6 +72,34 @@ describe('a component renamed by an engine upgrade', () => {
expect(data.entities[0]!.components[0]!.data['intensity']).toBe(2);
});
+ it('suffixes the flat physics set without touching the solid one', () => {
+ const { data, migrated } = migrateSceneData(sceneWith([
+ { type: 'RigidBody', data: { bodyType: 2, gravityScale: 0.5 } },
+ { type: 'BoxCollider', data: { halfExtents: { x: 1, y: 2 } } },
+ { type: 'CircleCollider', data: { radius: 3 } },
+ { type: 'CapsuleCollider', data: { radius: 1, halfHeight: 2 } },
+ { type: 'SegmentCollider', data: { density: 4 } },
+ { type: 'CharacterController', data: { skinWidth: 2 } },
+ { type: 'DistanceJoint', data: { length: 5 } },
+ // The names a careless rename eats: every one of these already ends
+ // in a plane, and a second suffix is a component nothing can load.
+ { type: 'RigidBody3D', data: { gravityScale: 1 } },
+ { type: 'BoxCollider3D', data: { isSensor: true } },
+ { type: 'CapsuleCollider3D', data: { radius: 1 } },
+ { type: 'CharacterController3D', data: { slopeLimit: 45 } },
+ { type: 'DistanceJoint3D', data: { minDistance: 1 } },
+ ]));
+ expect(migrated).toBe(true);
+ expect(componentsOf(data).map((c) => c.type)).toEqual([
+ 'RigidBody2D', 'BoxCollider2D', 'CircleCollider2D', 'CapsuleCollider2D',
+ 'SegmentCollider2D', 'CharacterController2D', 'DistanceJoint2D',
+ 'RigidBody3D', 'BoxCollider3D', 'CapsuleCollider3D', 'CharacterController3D',
+ 'DistanceJoint3D',
+ ]);
+ expect(componentsOf(data)[0]!.data).toEqual({ bodyType: 2, gravityScale: 0.5 });
+ expect(componentsOf(data)[5]!.data).toEqual({ skinWidth: 2 });
+ });
+
it('stamps the format version that tells an older engine to refuse the file', () => {
const { data } = migrateSceneData(sceneWith([{ type: 'Light2D', data: {} }]));
expect(data.version).toBe(SCENE_FORMAT_VERSION);
diff --git a/sdk/tests/entity-visibility.test.ts b/sdk/tests/entity-visibility.test.ts
index 84b1ae114..1d7ad69e9 100644
--- a/sdk/tests/entity-visibility.test.ts
+++ b/sdk/tests/entity-visibility.test.ts
@@ -93,7 +93,7 @@ describe('Entity visibility helpers', () => {
// The discrimination the declaration buys: plenty of components carry an
// `enabled` field without drawing anything, and hiding an entity must not
// switch its physics off.
- it.each(['BoxCollider', 'RigidBody', 'UIScroll'])('leaves a non-renderable %s alone', (comp) => {
+ it.each(['BoxCollider2D', 'RigidBody2D', 'UIScroll'])('leaves a non-renderable %s alone', (comp) => {
const world = mockWorld();
world._components.set('Sprite', { enabled: true });
world._components.set(comp, { enabled: true });
@@ -106,7 +106,7 @@ describe('Entity visibility helpers', () => {
it('a non-renderable alone is not something that can be hidden', () => {
const world = mockWorld();
- world._components.set('BoxCollider', { enabled: true });
+ world._components.set('BoxCollider2D', { enabled: true });
expect(hasVisibility(world, 1 as any)).toBe(false);
});
diff --git a/sdk/tests/mover-smoke.mjs b/sdk/tests/mover-smoke.mjs
index 29968fbfc..a3d9b2591 100644
--- a/sdk/tests/mover-smoke.mjs
+++ b/sdk/tests/mover-smoke.mjs
@@ -1,7 +1,7 @@
// Headless validation of the native character mover (physics_moveCharacter).
// Loads the built physics wasm directly, builds static geometry, and checks the
// resting/wedge/landing behavior plus the skin-width, floor-snap, and ceiling
-// options wired through from the CharacterController component.
+// options wired through from the CharacterController2D component.
import { readFileSync } from 'node:fs';
import path from 'node:path';
import { requireWasm } from '../../tools/lib/wasmDir.mjs';
diff --git a/sdk/tests/physics-features.test.ts b/sdk/tests/physics-features.test.ts
index b7dde3a2f..734bb9732 100644
--- a/sdk/tests/physics-features.test.ts
+++ b/sdk/tests/physics-features.test.ts
@@ -4,14 +4,14 @@
* @file One-way platform + motor joint component contracts. The runtime behaviour
* (pass-through, drive, drag) is proven end-to-end against the real wasm in
* physics-features-smoke.mjs; these guard the TS-side wiring that feeds it —
- * defaults, registration, and MotorJoint's place in the joint reconcile.
+ * defaults, registration, and MotorJoint2D's place in the joint reconcile.
*/
import { describe, it, expect } from 'vitest';
import { World } from '../src/ecs/world';
import { createMockModule } from './mocks/wasm';
import {
- OneWayPlatform, MotorJoint,
- type OneWayPlatformData, type MotorJointData,
+ OneWayPlatform2D, MotorJoint2D,
+ type OneWayPlatform2DData, type MotorJoint2DData,
} from '../src/physics/PhysicsComponents';
import { jointChangedOrGone } from '../src/physics/PhysicsSystem';
@@ -22,17 +22,17 @@ function testWorld(): World {
return world;
}
-describe('OneWayPlatform component', () => {
+describe('OneWayPlatform2D component', () => {
it('defaults to a solid top (+Y) and enabled', () => {
- const d = OneWayPlatform._default as OneWayPlatformData;
+ const d = OneWayPlatform2D._default as OneWayPlatform2DData;
expect(d.normal).toEqual({ x: 0, y: 1 });
expect(d.enabled).toBe(true);
});
});
-describe('MotorJoint component', () => {
+describe('MotorJoint2D component', () => {
it('defaults are inert (no drive) with connectedEntity unset', () => {
- const d = MotorJoint._default as MotorJointData;
+ const d = MotorJoint2D._default as MotorJoint2DData;
expect(d.connectedEntity).toBe(-1);
expect(d.linearVelocity).toEqual({ x: 0, y: 0 });
expect(d.maxVelocityForce).toBe(0);
@@ -42,7 +42,7 @@ describe('MotorJoint component', () => {
it('participates in the joint reconcile — present + unedited is left intact', () => {
const world = testWorld();
const e = world.spawn();
- world.insert(e, MotorJoint, {} as never);
+ world.insert(e, MotorJoint2D, {} as never);
expect(jointChangedOrGone(world, e, world.getWorldTick())).toBe(false);
});
diff --git a/sdk/tests/physics-module-contract.test.ts b/sdk/tests/physics-module-contract.test.ts
index 2d0c0a5ff..5d2cedd90 100644
--- a/sdk/tests/physics-module-contract.test.ts
+++ b/sdk/tests/physics-module-contract.test.ts
@@ -6,7 +6,7 @@
* `PhysicsWasmModule` is a TypeScript interface and therefore gone at run time.
* A `physics.wasm` built before the JS that drives it installed happily and then
* threw `_physics_capturePoses is not a function` twice a frame for the length
- * of the session — for anyone who put a RigidBody in a scene and pressed Play.
+ * of the session — for anyone who put a RigidBody2D in a scene and pressed Play.
*/
import { describe, it, expect, vi } from 'vitest';
import { PhysicsPlugin } from '../src/physics/PhysicsPlugin';
diff --git a/sdk/tests/physics3d-ecs.test.ts b/sdk/tests/physics3d-ecs.test.ts
index b7b6d052d..5d8bbd134 100644
--- a/sdk/tests/physics3d-ecs.test.ts
+++ b/sdk/tests/physics3d-ecs.test.ts
@@ -602,7 +602,7 @@ describe('a scene asks for the world it needs', () => {
it('does not confuse the two worlds', () => {
// A 2D scene must not drag in a 1.2MB module it has no use for, and a 3D
// scene must not be served the solver that cannot move it.
- expect(sceneUses3DPhysics(sceneWith('RigidBody', 'BoxCollider') as never)).toBe(false);
+ expect(sceneUses3DPhysics(sceneWith('RigidBody2D', 'BoxCollider2D') as never)).toBe(false);
expect(sceneUsesPhysics(sceneWith('RigidBody3D', 'BoxCollider3D') as never)).toBe(false);
});
});
diff --git a/sdk/tests/physicsDebugDraw.test.ts b/sdk/tests/physicsDebugDraw.test.ts
index 5e9194fe7..8506a9a73 100644
--- a/sdk/tests/physicsDebugDraw.test.ts
+++ b/sdk/tests/physicsDebugDraw.test.ts
@@ -112,12 +112,12 @@ describe('drawPhysicsDebug', () => {
} as PhysicsDebugDrawConfig);
const entity = mockEntity({
- RigidBody: { bodyType: BodyType.Static, enabled: true },
+ RigidBody2D: { bodyType: BodyType.Static, enabled: true },
Transform: {
worldPosition: { x: 100, y: 200 },
worldRotation: { w: 1, x: 0, y: 0, z: 0 },
},
- BoxCollider: {
+ BoxCollider2D: {
halfExtents: { x: 0.5, y: 0.5 },
offset: { x: 0, y: 0 },
isSensor: false,
@@ -137,12 +137,12 @@ describe('drawPhysicsDebug', () => {
} as PhysicsDebugDrawConfig);
const entity = mockEntity({
- RigidBody: { bodyType: BodyType.Dynamic, enabled: true },
+ RigidBody2D: { bodyType: BodyType.Dynamic, enabled: true },
Transform: {
worldPosition: { x: 50, y: 50 },
worldRotation: { w: 1, x: 0, y: 0, z: 0 },
},
- CircleCollider: {
+ CircleCollider2D: {
radius: 1.0,
offset: { x: 0, y: 0 },
isSensor: false,
@@ -162,12 +162,12 @@ describe('drawPhysicsDebug', () => {
} as PhysicsDebugDrawConfig);
const entity = mockEntity({
- RigidBody: { bodyType: BodyType.Dynamic, enabled: true },
+ RigidBody2D: { bodyType: BodyType.Dynamic, enabled: true },
Transform: {
worldPosition: { x: 0, y: 0 },
worldRotation: { w: 1, x: 0, y: 0, z: 0 },
},
- CapsuleCollider: {
+ CapsuleCollider2D: {
radius: 0.25,
halfHeight: 0.5,
offset: { x: 0, y: 0 },
@@ -189,12 +189,12 @@ describe('drawPhysicsDebug', () => {
} as PhysicsDebugDrawConfig);
const entity = mockEntity({
- RigidBody: { bodyType: BodyType.Dynamic, enabled: false },
+ RigidBody2D: { bodyType: BodyType.Dynamic, enabled: false },
Transform: {
worldPosition: { x: 0, y: 0 },
worldRotation: { w: 1, x: 0, y: 0, z: 0 },
},
- BoxCollider: {
+ BoxCollider2D: {
halfExtents: { x: 0.5, y: 0.5 },
offset: { x: 0, y: 0 },
isSensor: false,
@@ -214,12 +214,12 @@ describe('drawPhysicsDebug', () => {
} as PhysicsDebugDrawConfig);
const entity = mockEntity({
- RigidBody: { bodyType: BodyType.Static, enabled: true },
+ RigidBody2D: { bodyType: BodyType.Static, enabled: true },
Transform: {
worldPosition: { x: 0, y: 0 },
worldRotation: { w: 1, x: 0, y: 0, z: 0 },
},
- BoxCollider: {
+ BoxCollider2D: {
halfExtents: { x: 1, y: 1 },
offset: { x: 0, y: 0 },
isSensor: true,
@@ -245,7 +245,7 @@ describe('drawPhysicsDebug', () => {
});
const entity = mockEntity({
- RigidBody: { bodyType: BodyType.Dynamic, enabled: true },
+ RigidBody2D: { bodyType: BodyType.Dynamic, enabled: true },
Transform: {
worldPosition: { x: 100, y: 200 },
worldRotation: { w: 1, x: 0, y: 0, z: 0 },
@@ -269,7 +269,7 @@ describe('drawPhysicsDebug', () => {
});
const entity = mockEntity({
- RigidBody: { bodyType: BodyType.Static, enabled: true },
+ RigidBody2D: { bodyType: BodyType.Static, enabled: true },
Transform: {
worldPosition: { x: 0, y: 0 },
worldRotation: { w: 1, x: 0, y: 0, z: 0 },
@@ -319,21 +319,21 @@ describe('drawPhysicsDebug', () => {
} as PhysicsDebugDrawConfig);
const staticEntity = mockEntity({
- RigidBody: { bodyType: BodyType.Static, enabled: true },
+ RigidBody2D: { bodyType: BodyType.Static, enabled: true },
Transform: { worldPosition: { x: 0, y: 0 }, worldRotation: { w: 1, x: 0, y: 0, z: 0 } },
- CircleCollider: { radius: 1, offset: { x: 0, y: 0 }, isSensor: false },
+ CircleCollider2D: { radius: 1, offset: { x: 0, y: 0 }, isSensor: false },
});
const dynamicEntity = mockEntity({
- RigidBody: { bodyType: BodyType.Dynamic, enabled: true },
+ RigidBody2D: { bodyType: BodyType.Dynamic, enabled: true },
Transform: { worldPosition: { x: 0, y: 0 }, worldRotation: { w: 1, x: 0, y: 0, z: 0 } },
- CircleCollider: { radius: 1, offset: { x: 0, y: 0 }, isSensor: false },
+ CircleCollider2D: { radius: 1, offset: { x: 0, y: 0 }, isSensor: false },
});
const kinematicEntity = mockEntity({
- RigidBody: { bodyType: BodyType.Kinematic, enabled: true },
+ RigidBody2D: { bodyType: BodyType.Kinematic, enabled: true },
Transform: { worldPosition: { x: 0, y: 0 }, worldRotation: { w: 1, x: 0, y: 0, z: 0 } },
- CircleCollider: { radius: 1, offset: { x: 0, y: 0 }, isSensor: false },
+ CircleCollider2D: { radius: 1, offset: { x: 0, y: 0 }, isSensor: false },
});
const app = createMockApp([staticEntity, dynamicEntity, kinematicEntity], resources);
@@ -363,12 +363,12 @@ describe('drawPhysicsDebug', () => {
const qZ = Math.sin(angle / 2);
const entity = mockEntity({
- RigidBody: { bodyType: BodyType.Static, enabled: true },
+ RigidBody2D: { bodyType: BodyType.Static, enabled: true },
Transform: {
worldPosition: { x: 100, y: 100 },
worldRotation: { w: qW, x: 0, y: 0, z: qZ },
},
- CircleCollider: {
+ CircleCollider2D: {
radius: 1,
offset: { x: 1, y: 0 },
isSensor: false,
diff --git a/sdk/tests/physicsReconcile.test.ts b/sdk/tests/physicsReconcile.test.ts
index d7f2c09ba..237617777 100644
--- a/sdk/tests/physicsReconcile.test.ts
+++ b/sdk/tests/physicsReconcile.test.ts
@@ -10,7 +10,7 @@ import { describe, it, expect } from 'vitest';
import { World } from '../src/ecs/world';
import { createMockModule } from './mocks/wasm';
import {
- BoxCollider, CircleCollider, CapsuleCollider, RevoluteJoint,
+ BoxCollider2D, CircleCollider2D, CapsuleCollider2D, RevoluteJoint2D,
} from '../src/physics/PhysicsComponents';
import { colliderSignature, jointChangedOrGone, jointPartnerGone } from '../src/physics/PhysicsSystem';
@@ -31,18 +31,18 @@ describe('colliderSignature', () => {
it('sets one bit per present collider type (Box=bit0, Circle=bit1)', () => {
const world = testWorld();
const e = world.spawn();
- world.insert(e, BoxCollider, {} as never);
+ world.insert(e, BoxCollider2D, {} as never);
expect(colliderSignature(world, e)).toBe(0b1);
- world.insert(e, CircleCollider, {} as never);
+ world.insert(e, CircleCollider2D, {} as never);
expect(colliderSignature(world, e)).toBe(0b11);
});
it('changes when the collider set changes (drives shape rebuild)', () => {
const world = testWorld();
const e = world.spawn();
- world.insert(e, BoxCollider, {} as never);
+ world.insert(e, BoxCollider2D, {} as never);
const before = colliderSignature(world, e);
- world.insert(e, CapsuleCollider, {} as never); // bit 2
+ world.insert(e, CapsuleCollider2D, {} as never); // bit 2
expect(colliderSignature(world, e)).not.toBe(before);
expect(colliderSignature(world, e)).toBe(0b101);
});
@@ -58,7 +58,7 @@ describe('jointChangedOrGone', () => {
it('is false for a present joint not changed since the given tick', () => {
const world = testWorld();
const e = world.spawn();
- world.insert(e, RevoluteJoint, {} as never);
+ world.insert(e, RevoluteJoint2D, {} as never);
// isChangedSince(currentTick) is false (it was last touched this tick),
// so a present, unedited joint is left intact.
expect(jointChangedOrGone(world, e, world.getWorldTick())).toBe(false);
@@ -70,7 +70,7 @@ describe('jointPartnerGone', () => {
const world = testWorld();
const owner = world.spawn();
const partner = world.spawn();
- world.insert(owner, RevoluteJoint, { connectedEntity: partner } as never);
+ world.insert(owner, RevoluteJoint2D, { connectedEntity: partner } as never);
expect(jointPartnerGone(world, owner, new Set([owner, partner]))).toBe(false);
});
@@ -78,7 +78,7 @@ describe('jointPartnerGone', () => {
const world = testWorld();
const owner = world.spawn();
const partner = world.spawn();
- world.insert(owner, RevoluteJoint, { connectedEntity: partner } as never);
+ world.insert(owner, RevoluteJoint2D, { connectedEntity: partner } as never);
// Partner despawned → no longer tracked; the joint (auto-destroyed by
// Box2D) must be re-established, not left silently dead forever.
expect(jointPartnerGone(world, owner, new Set([owner]))).toBe(true);
diff --git a/sdk/tests/scene-uses-physics.test.ts b/sdk/tests/scene-uses-physics.test.ts
index 57b650270..823af73c4 100644
--- a/sdk/tests/scene-uses-physics.test.ts
+++ b/sdk/tests/scene-uses-physics.test.ts
@@ -25,7 +25,7 @@ describe('sceneUsesPhysics', () => {
});
it('true for a physics component', () => {
- expect(sceneUsesPhysics(scene([{ type: 'RigidBody' }]))).toBe(true);
+ expect(sceneUsesPhysics(scene([{ type: 'RigidBody2D' }]))).toBe(true);
});
it('true for a TilemapLayer with baked collidable ids (legacy scenes)', () => {
diff --git a/sdk/tests/schedule-declared.test.ts b/sdk/tests/schedule-declared.test.ts
index 8242b8006..af1c9ed6a 100644
--- a/sdk/tests/schedule-declared.test.ts
+++ b/sdk/tests/schedule-declared.test.ts
@@ -18,7 +18,7 @@ import { App } from '../src/app/app';
import { Schedule, defineSystem, GetWorld } from '../src/ecs/system';
import { simulationBasePlugins } from '../src/app/pluginSets';
import { StatsPlugin } from '../src/stats';
-import { registerCharacterControllerSystem } from '../src/physics/CharacterController';
+import { registerCharacterControllerSystem } from '../src/physics/CharacterController2D';
import { setPlatform } from '../src/platform/base';
import { webAdapter } from '../src/platform/web';
diff --git a/sdk/tests/tiled-tile-collision.test.ts b/sdk/tests/tiled-tile-collision.test.ts
index 4526200aa..369c13f24 100644
--- a/sdk/tests/tiled-tile-collision.test.ts
+++ b/sdk/tests/tiled-tile-collision.test.ts
@@ -109,9 +109,9 @@ describe('generateLayerTileShapes', () => {
world, map.layers[0].tiles, 2, 1, map.tileShapes, 16, 16, 0, 0, 100);
expect(spawned).toHaveLength(2);
const c = comps.get(spawned[0] as number)!;
- expect(c.get('CircleCollider')).toBeDefined();
- expect(c.get('CircleCollider').radius).toBeCloseTo(8 / 100); // physics units
- expect(c.get('RigidBody')).toBeDefined();
+ expect(c.get('CircleCollider2D')).toBeDefined();
+ expect(c.get('CircleCollider2D').radius).toBeCloseTo(8 / 100); // physics units
+ expect(c.get('RigidBody2D')).toBeDefined();
// Cell 1 sits one tile to the right.
expect(comps.get(spawned[1] as number)!.get('Transform').position.x).toBeCloseTo(24);
});
diff --git a/sdk/tests/tilemap-polygon-collision.test.ts b/sdk/tests/tilemap-polygon-collision.test.ts
index 38f687663..8f875536a 100644
--- a/sdk/tests/tilemap-polygon-collision.test.ts
+++ b/sdk/tests/tilemap-polygon-collision.test.ts
@@ -69,7 +69,7 @@ describe('polygonLocalVerts flip transforms', () => {
});
describe('generateChunkPolygonCollision', () => {
- it('spawns one PolygonCollider per polygon tile at the cell centre', () => {
+ it('spawns one PolygonCollider2D per polygon tile at the cell centre', () => {
const { world, comps } = mockWorld();
const tiles = new Uint16Array(CHUNK_SIZE * CHUNK_SIZE);
tiles[0] = encodeTile(3); // (0,0) → polygon tile
@@ -79,8 +79,8 @@ describe('generateChunkPolygonCollision', () => {
expect(ents).toHaveLength(1);
const c = comps.get(ents[0] as number)!;
expect(c.get('Transform').position).toMatchObject({ x: 8, y: -8 }); // cell (0,0) centre
- expect(c.get('PolygonCollider').vertices).toHaveLength(3);
- expect(c.get('RigidBody').bodyType).toBeDefined();
+ expect(c.get('PolygonCollider2D').vertices).toHaveLength(3);
+ expect(c.get('RigidBody2D').bodyType).toBeDefined();
});
it('flips the polygon when the placed cell carries flip flags', () => {
@@ -89,7 +89,7 @@ describe('generateChunkPolygonCollision', () => {
tiles[0] = encodeTile(1, { flipH: true, flipV: false, flipD: false });
const shapes = new Map<number, [number, number][]>([[1, [[0, 0]]]]); // top-left point
const ents = generateChunkPolygonCollision(world, [{ x: 0, y: 0, tiles }], shapes, 16, 16, 0, 0);
- const v = comps.get(ents[0] as number)!.get('PolygonCollider').vertices[0];
+ const v = comps.get(ents[0] as number)!.get('PolygonCollider2D').vertices[0];
expect(v).toEqual({ x: 8, y: 8 }); // top-left mirrored to top-right under flipH
});
@@ -111,31 +111,31 @@ describe('generateChunkTileShapes (rich per-tile shapes)', () => {
return comps.get(ents[0] as number)!;
}
- it('circle tile → CircleCollider (radius as tile-width fraction, centre offset)', () => {
+ it('circle tile → CircleCollider2D (radius as tile-width fraction, centre offset)', () => {
const c = spawnOne({ shape: { type: 'circle', cx: 0.5, cy: 0.5, r: 0.5 } });
- expect(c.get('CircleCollider').radius).toBeCloseTo(8); // 0.5 × 16
- expect(c.get('CircleCollider').offset).toEqual({ x: 0, y: 0 }); // centred
- expect(c.has('BoxCollider')).toBe(false);
+ expect(c.get('CircleCollider2D').radius).toBeCloseTo(8); // 0.5 × 16
+ expect(c.get('CircleCollider2D').offset).toEqual({ x: 0, y: 0 }); // centred
+ expect(c.has('BoxCollider2D')).toBe(false);
});
it('box tile carries the material + sensor overrides it set', () => {
const c = spawnOne({ shape: { type: 'box' }, friction: 0.1, restitution: 0.9, density: 3, sensor: true });
- expect(c.get('BoxCollider')).toMatchObject({ friction: 0.1, restitution: 0.9, density: 3, isSensor: true });
+ expect(c.get('BoxCollider2D')).toMatchObject({ friction: 0.1, restitution: 0.9, density: 3, isSensor: true });
});
- it('one-way box → OneWayPlatform with the solid-top normal', () => {
+ it('one-way box → OneWayPlatform2D with the solid-top normal', () => {
const c = spawnOne({ shape: { type: 'box' }, oneWay: { nx: 0, ny: 1 } });
- expect(c.get('OneWayPlatform').normal).toEqual({ x: 0, y: 1 });
+ expect(c.get('OneWayPlatform2D').normal).toEqual({ x: 0, y: 1 });
});
it('a vertically flipped cell flips the one-way normal', () => {
const c = spawnOne({ shape: { type: 'box' }, oneWay: { nx: 0, ny: 1 } }, { flipV: true });
- expect(c.get('OneWayPlatform').normal).toEqual({ x: 0, y: -1 });
+ expect(c.get('OneWayPlatform2D').normal).toEqual({ x: 0, y: -1 });
});
- it('polygon tile → PolygonCollider (vertices from the flip-aware transform)', () => {
+ it('polygon tile → PolygonCollider2D (vertices from the flip-aware transform)', () => {
const c = spawnOne({ shape: { type: 'polygon', points: [[0, 1], [1, 1], [1, 0]] } });
- expect(c.get('PolygonCollider').vertices).toHaveLength(3);
- expect(c.has('OneWayPlatform')).toBe(false);
+ expect(c.get('PolygonCollider2D').vertices).toHaveLength(3);
+ expect(c.has('OneWayPlatform2D')).toBe(false);
});
});
diff --git a/sdk/tests/tilemap.test.ts b/sdk/tests/tilemap.test.ts
index c4ab12d75..954b3492c 100644
--- a/sdk/tests/tilemap.test.ts
+++ b/sdk/tests/tilemap.test.ts
@@ -25,7 +25,7 @@ import type { TilesetAsset } from '../src/tilemap/tilesetAsset';
import { mergeCollisionTiles } from '../src/tilemap/collisionMerge';
import { TilemapAssetLoader } from '../src/asset/loaders/TilemapAssetLoader';
import type { LoadContext } from '../src/asset/AssetLoader';
-import { BodyType, RigidBody, BoxCollider, CircleCollider, PolygonCollider, ChainCollider } from '../src/physics/PhysicsComponents';
+import { BodyType, RigidBody2D, BoxCollider2D, CircleCollider2D, PolygonCollider2D, ChainCollider2D } from '../src/physics/PhysicsComponents';
import { clearUserComponents, Transform, Marker } from '../src/ecs/component';
import type { World } from '../src/ecs/world';
import type { Entity } from '../src/types';
@@ -1213,14 +1213,14 @@ describe('loadTiledCollisionObjects', () => {
expect(entities).toHaveLength(1);
const insertCalls = (world.insert as any).mock.calls;
- const rbInsert = insertCalls.find((c: any) => c[1]._name === 'RigidBody');
+ const rbInsert = insertCalls.find((c: any) => c[1]._name === 'RigidBody2D');
expect(rbInsert[2].bodyType).toBe(0);
// Centre (80, 112) in Tiled pixels -> world (80, -112), like a tile at that spot.
const tfInsert = insertCalls.find((c: any) => c[1]._name === 'Transform');
expect(tfInsert[2].position).toEqual({ x: 80, y: -112, z: 0 });
- const boxInsert = insertCalls.find((c: any) => c[1]._name === 'BoxCollider');
+ const boxInsert = insertCalls.find((c: any) => c[1]._name === 'BoxCollider2D');
expect(boxInsert[2].halfExtents).toEqual({ x: 16, y: 16 });
});
@@ -1235,11 +1235,11 @@ describe('loadTiledCollisionObjects', () => {
const insertCalls = (world.insert as any).mock.calls;
expect(insertCalls.find((c: any) => c[1]._name === 'Transform')[2].position)
.toEqual({ x: 80, y: -112, z: 0 });
- expect(insertCalls.find((c: any) => c[1]._name === 'BoxCollider')[2].halfExtents)
+ expect(insertCalls.find((c: any) => c[1]._name === 'BoxCollider2D')[2].halfExtents)
.toEqual({ x: 0.16, y: 0.16 });
});
- it('should create CircleCollider on the mean semi-axis for ellipse objects', () => {
+ it('should create CircleCollider2D on the mean semi-axis for ellipse objects', () => {
const world = createMockWorld();
const mapData = makeMap([makeGroup('Collision', [
makeObject({ shape: 'ellipse', x: 0, y: 0, width: 64, height: 32 }),
@@ -1248,7 +1248,7 @@ describe('loadTiledCollisionObjects', () => {
loadTiledCollisionObjects(world, mapData, 0, 0);
const insertCalls = (world.insert as any).mock.calls;
- const circleInsert = insertCalls.find((c: any) => c[1]._name === 'CircleCollider');
+ const circleInsert = insertCalls.find((c: any) => c[1]._name === 'CircleCollider2D');
expect(circleInsert[2].radius).toBe(24);
expect(insertCalls.find((c: any) => c[1]._name === 'Transform')[2].position)
.toEqual({ x: 32, y: -16, z: 0 });
@@ -1265,7 +1265,7 @@ describe('loadTiledCollisionObjects', () => {
expect(world.spawn).not.toHaveBeenCalled();
});
- it('should create a real PolygonCollider (y-flipped local verts) for small polygons', () => {
+ it('should create a real PolygonCollider2D (y-flipped local verts) for small polygons', () => {
const world = createMockWorld();
const mapData = makeMap([makeGroup('Polys', [
makeObject({ shape: 'polygon', x: 16, y: 48, vertices: [0, 0, 40, 0, 40, 20, 0, 20] }),
@@ -1274,7 +1274,7 @@ describe('loadTiledCollisionObjects', () => {
loadTiledCollisionObjects(world, mapData, 0, 0);
const insertCalls = (world.insert as any).mock.calls;
- const polyInsert = insertCalls.find((c: any) => c[1]._name === 'PolygonCollider');
+ const polyInsert = insertCalls.find((c: any) => c[1]._name === 'PolygonCollider2D');
expect(polyInsert[2].vertices).toEqual([
{ x: 0, y: 0 }, { x: 40, y: 0 }, { x: 40, y: -20 }, { x: 0, y: -20 },
]);
@@ -1282,7 +1282,7 @@ describe('loadTiledCollisionObjects', () => {
.toEqual({ x: 16, y: -48, z: 0 });
});
- it('should create an open ChainCollider for polylines', () => {
+ it('should create an open ChainCollider2D for polylines', () => {
const world = createMockWorld();
const mapData = makeMap([makeGroup('Terrain', [
makeObject({ shape: 'polyline', x: 0, y: 64, vertices: [0, 0, 32, -16, 64, 0, 96, 8] }),
@@ -1291,7 +1291,7 @@ describe('loadTiledCollisionObjects', () => {
loadTiledCollisionObjects(world, mapData, 0, 0, 2);
const insertCalls = (world.insert as any).mock.calls;
- const chainInsert = insertCalls.find((c: any) => c[1]._name === 'ChainCollider');
+ const chainInsert = insertCalls.find((c: any) => c[1]._name === 'ChainCollider2D');
expect(chainInsert[2].isLoop).toBe(false);
expect(chainInsert[2].points).toEqual([
{ x: 0, y: 0 }, { x: 16, y: 8 }, { x: 32, y: 0 }, { x: 48, y: -4 },
@@ -1314,8 +1314,8 @@ describe('loadTiledCollisionObjects', () => {
loadTiledCollisionObjects(world, mapData, 0, 0);
const insertCalls = (world.insert as any).mock.calls;
- expect(insertCalls.find((c: any) => c[1]._name === 'PolygonCollider')).toBeUndefined();
- const boxInsert = insertCalls.find((c: any) => c[1]._name === 'BoxCollider');
+ expect(insertCalls.find((c: any) => c[1]._name === 'PolygonCollider2D')).toBeUndefined();
+ const boxInsert = insertCalls.find((c: any) => c[1]._name === 'BoxCollider2D');
expect(boxInsert[2].halfExtents.x).toBeCloseTo(50, 3);
});
@@ -1448,8 +1448,8 @@ describe('loadTiledMap — collision integration', () => {
const e = spawnObjectRegion(world, obj({ shape: 'rect' }), parent, 100, true);
expect(e).not.toBeNull();
expect(world.get(e!, Marker)).toEqual({ type: 'door', properties: { event: 'open' } });
- expect(world.get(e!, RigidBody).bodyType).toBe(0); // Static
- const box = world.get(e!, BoxCollider);
+ expect(world.get(e!, RigidBody2D).bodyType).toBe(0); // Static
+ const box = world.get(e!, BoxCollider2D);
expect(box.isSensor).toBe(true);
expect(box.halfExtents).toEqual({ x: 40 * 0.5 / 100, y: 20 * 0.5 / 100 });
expect(world.get(e!, Transform).position).toEqual({ x: 120, y: -60, z: 0 }); // local centre, y-up
@@ -1459,16 +1459,16 @@ describe('loadTiledMap — collision integration', () => {
it('sensor=false → the SAME shape as a SOLID collider (collision-group geometry)', () => {
const world = createMockWorld();
const e = spawnObjectRegion(world, obj({ shape: 'rect' }), world.spawn(), 100, false);
- expect(world.get(e!, BoxCollider).isSensor).toBe(false);
- expect(world.get(e!, RigidBody).bodyType).toBe(0);
+ expect(world.get(e!, BoxCollider2D).isSensor).toBe(false);
+ expect(world.get(e!, RigidBody2D).bodyType).toBe(0);
});
it('ellipse → circle on the mean semi-axis; polyline → open chain', () => {
const world = createMockWorld();
- const c = world.get(spawnObjectRegion(world, obj({ shape: 'ellipse', width: 80, height: 40 }), world.spawn(), 100, true)!, CircleCollider);
+ const c = world.get(spawnObjectRegion(world, obj({ shape: 'ellipse', width: 80, height: 40 }), world.spawn(), 100, true)!, CircleCollider2D);
expect(c.isSensor).toBe(true);
expect(c.radius).toBeCloseTo((80 + 40) * 0.25 / 100);
- const chain = world.get(spawnObjectRegion(world, obj({ shape: 'polyline', vertices: [0, 0, 10, 0, 10, 10] }), world.spawn(), 100, false)!, ChainCollider);
+ const chain = world.get(spawnObjectRegion(world, obj({ shape: 'polyline', vertices: [0, 0, 10, 0, 10, 10] }), world.spawn(), 100, false)!, ChainCollider2D);
expect(chain.isLoop).toBe(false);
// A sensor-group polyline is skipped (open chains have no sensor mode).
expect(spawnObjectRegion(world, obj({ shape: 'polyline', vertices: [0, 0, 10, 10] }), world.spawn(), 100, true)).toBeNull();
@@ -1476,7 +1476,7 @@ describe('loadTiledMap — collision integration', () => {
it('polygon (≤8 pts) → polygon; point / gid → null (projected elsewhere)', () => {
const world = createMockWorld();
- expect(world.get(spawnObjectRegion(world, obj({ shape: 'polygon', vertices: [0, 0, 30, 0, 30, 30] }), world.spawn(), 100, true)!, PolygonCollider).isSensor).toBe(true);
+ expect(world.get(spawnObjectRegion(world, obj({ shape: 'polygon', vertices: [0, 0, 30, 0, 30, 30] }), world.spawn(), 100, true)!, PolygonCollider2D).isSensor).toBe(true);
expect(spawnObjectRegion(world, obj({ shape: 'point' }), world.spawn(), 100, true)).toBeNull();
expect(spawnObjectRegion(world, obj({ shape: 'rect', gid: 5 }), world.spawn(), 100, true)).toBeNull();
});
@@ -1501,7 +1501,7 @@ describe('loadTiledMap — collision integration', () => {
const legacy = generateObjectCollision(
lw, [{ name: 'g', visible: true, properties: new Map(), objects: [o] } as never], 0, 0, 100,
)[0];
- for (const C of [BoxCollider, CircleCollider, PolygonCollider, ChainCollider]) {
+ for (const C of [BoxCollider2D, CircleCollider2D, PolygonCollider2D, ChainCollider2D]) {
expect(rw.get(region, C)).toEqual(lw.get(legacy, C));
}
expect(rw.get(region, Transform).position).toEqual(lw.get(legacy, Transform).position);
@@ -1532,7 +1532,7 @@ describe('loadTiledMap — collision integration', () => {
});
describe('generateLayerCollision (B2-1 runtime tile collision)', () => {
- interface MockEntity { Transform?: any; RigidBody?: any; BoxCollider?: any }
+ interface MockEntity { Transform?: any; RigidBody2D?: any; BoxCollider2D?: any }
function createMockWorld(): { world: World; store: Map<number, MockEntity> } {
let nextId = 1;
@@ -1560,8 +1560,8 @@ describe('generateLayerCollision (B2-1 runtime tile collision)', () => {
const e = store.get(ents[0])!;
// y-DOWN (matches the renderer): row 0 top edge at origin y=0, centre below.
expect(e.Transform.position).toEqual({ x: 16, y: -16, z: 0 });
- expect(e.BoxCollider.halfExtents).toEqual({ x: 16, y: 16 });
- expect(e.RigidBody.bodyType).toBe(BodyType.Static);
+ expect(e.BoxCollider2D.halfExtents).toEqual({ x: 16, y: 16 });
+ expect(e.RigidBody2D.bodyType).toBe(BodyType.Static);
});
it('places rows y-down so lower rows sit at more-negative world-Y', () => {
diff --git a/sdk/tests/velocity.test.ts b/sdk/tests/velocity.test.ts
index 8f834e63b..0165ae879 100644
--- a/sdk/tests/velocity.test.ts
+++ b/sdk/tests/velocity.test.ts
@@ -53,11 +53,11 @@ describe('VelocitySystem', () => {
});
it('skips entities owned by the physics solver', () => {
- const RigidBody = defineComponent('RigidBody', { bodyType: 0 });
+ const RigidBody2D = defineComponent('RigidBody2D', { bodyType: 0 });
const e = world.spawn();
world.insert(e, Transform, { position: { x: 0, y: 0, z: 0 } });
world.insert(e, Velocity, { linear: { x: 100, y: 0, z: 0 } });
- world.insert(e, RigidBody, {});
+ world.insert(e, RigidBody2D, {});
runner.run(velocitySystem);
diff --git a/src/esengine/bindings/EditorAPI.generated.cpp b/src/esengine/bindings/EditorAPI.generated.cpp
index 5728a4ad8..6d06c46c5 100644
--- a/src/esengine/bindings/EditorAPI.generated.cpp
+++ b/src/esengine/bindings/EditorAPI.generated.cpp
@@ -2,10 +2,10 @@
* @file EditorAPI.generated.cpp
* @brief Auto-generated editor API with string-dispatched component access
* @details Generated by EHT - DO NOT EDIT
- * @schema_hash 1bc8702f5edc3115
+ * @schema_hash e6b42602c58bf96a
*/
-#define ES_EDITOR_API_SCHEMA_HASH "1bc8702f5edc3115"
+#define ES_EDITOR_API_SCHEMA_HASH "e6b42602c58bf96a"
#include <emscripten/bind.h>
#include <string>
@@ -14,7 +14,7 @@
#include "../ecs/components/BitmapText.hpp"
#include "../ecs/components/Camera.hpp"
#include "../ecs/components/Canvas.hpp"
-#include "../ecs/components/Collider.hpp"
+#include "../ecs/components/Collider2D.hpp"
#include "../ecs/components/Draggable.hpp"
#include "../ecs/components/DragonBonesAnimation.hpp"
#include "../ecs/components/FlexContainer.hpp"
@@ -24,7 +24,7 @@
#include "../ecs/components/MeshRenderer.hpp"
#include "../ecs/components/ParticleEmitter.hpp"
#include "../ecs/components/ParticleForceField.hpp"
-#include "../ecs/components/RigidBody.hpp"
+#include "../ecs/components/RigidBody2D.hpp"
#include "../ecs/components/RigidBody3D.hpp"
#include "../ecs/components/ShadowCaster2D.hpp"
#include "../ecs/components/ShapeRenderer.hpp"
@@ -60,15 +60,15 @@ inline glm::quat eulerDegToQuat(const glm::vec3& deg) {
std::vector<std::string> editor_getComponentNames() {
return {
"BitmapText",
- "BoxCollider",
+ "BoxCollider2D",
"BoxCollider3D",
"Camera",
"Canvas",
- "CapsuleCollider",
+ "CapsuleCollider2D",
"CapsuleCollider3D",
"CharacterController3D",
"Children",
- "CircleCollider",
+ "CircleCollider2D",
"ConvexCollider3D",
"Draggable",
"DragonBonesAnimation",
@@ -81,9 +81,9 @@ std::vector<std::string> editor_getComponentNames() {
"Parent",
"ParticleEmitter",
"ParticleForceField",
- "RigidBody",
+ "RigidBody2D",
"RigidBody3D",
- "SegmentCollider",
+ "SegmentCollider2D",
"ShadowCaster2D",
"ShapeRenderer",
"SphereCollider3D",
@@ -120,19 +120,19 @@ std::string editor_getComponentSchema(const std::string& name) {
{"key":"font","type":"asset","group":"BitmapText"},
{"key":"enabled","type":"bool","group":"BitmapText"}
])JSON";
- } else if (name == "BoxCollider") {
+ } else if (name == "BoxCollider2D") {
return R"JSON([
- {"key":"halfExtents.x","type":"float","group":"BoxCollider"},
- {"key":"halfExtents.y","type":"float","group":"BoxCollider"},
- {"key":"offset.x","type":"float","group":"BoxCollider"},
- {"key":"offset.y","type":"float","group":"BoxCollider"},
- {"key":"density","type":"float","group":"BoxCollider"},
- {"key":"friction","type":"float","group":"BoxCollider"},
- {"key":"restitution","type":"float","group":"BoxCollider"},
- {"key":"isSensor","type":"bool","group":"BoxCollider"},
- {"key":"enabled","type":"bool","group":"BoxCollider"},
- {"key":"categoryBits","type":"int","group":"BoxCollider"},
- {"key":"maskBits","type":"int","group":"BoxCollider"}
+ {"key":"halfExtents.x","type":"float","group":"BoxCollider2D"},
+ {"key":"halfExtents.y","type":"float","group":"BoxCollider2D"},
+ {"key":"offset.x","type":"float","group":"BoxCollider2D"},
+ {"key":"offset.y","type":"float","group":"BoxCollider2D"},
+ {"key":"density","type":"float","group":"BoxCollider2D"},
+ {"key":"friction","type":"float","group":"BoxCollider2D"},
+ {"key":"restitution","type":"float","group":"BoxCollider2D"},
+ {"key":"isSensor","type":"bool","group":"BoxCollider2D"},
+ {"key":"enabled","type":"bool","group":"BoxCollider2D"},
+ {"key":"categoryBits","type":"int","group":"BoxCollider2D"},
+ {"key":"maskBits","type":"int","group":"BoxCollider2D"}
])JSON";
} else if (name == "BoxCollider3D") {
return R"JSON([
@@ -176,19 +176,19 @@ std::string editor_getComponentSchema(const std::string& name) {
{"key":"backgroundColor.a","type":"color","group":"Canvas"},
{"key":"layer","type":"int","group":"Canvas"}
])JSON";
- } else if (name == "CapsuleCollider") {
+ } else if (name == "CapsuleCollider2D") {
return R"JSON([
- {"key":"radius","type":"float","group":"CapsuleCollider"},
- {"key":"halfHeight","type":"float","group":"CapsuleCollider"},
- {"key":"offset.x","type":"float","group":"CapsuleCollider"},
- {"key":"offset.y","type":"float","group":"CapsuleCollider"},
- {"key":"density","type":"float","group":"CapsuleCollider"},
- {"key":"friction","type":"float","group":"CapsuleCollider"},
- {"key":"restitution","type":"float","group":"CapsuleCollider"},
- {"key":"isSensor","type":"bool","group":"CapsuleCollider"},
- {"key":"enabled","type":"bool","group":"CapsuleCollider"},
- {"key":"categoryBits","type":"int","group":"CapsuleCollider"},
- {"key":"maskBits","type":"int","group":"CapsuleCollider"}
+ {"key":"radius","type":"float","group":"CapsuleCollider2D"},
+ {"key":"halfHeight","type":"float","group":"CapsuleCollider2D"},
+ {"key":"offset.x","type":"float","group":"CapsuleCollider2D"},
+ {"key":"offset.y","type":"float","group":"CapsuleCollider2D"},
+ {"key":"density","type":"float","group":"CapsuleCollider2D"},
+ {"key":"friction","type":"float","group":"CapsuleCollider2D"},
+ {"key":"restitution","type":"float","group":"CapsuleCollider2D"},
+ {"key":"isSensor","type":"bool","group":"CapsuleCollider2D"},
+ {"key":"enabled","type":"bool","group":"CapsuleCollider2D"},
+ {"key":"categoryBits","type":"int","group":"CapsuleCollider2D"},
+ {"key":"maskBits","type":"int","group":"CapsuleCollider2D"}
])JSON";
} else if (name == "CapsuleCollider3D") {
return R"JSON([
@@ -225,18 +225,18 @@ std::string editor_getComponentSchema(const std::string& name) {
return R"JSON([
{"key":"entities","type":"entity","group":"Children"}
])JSON";
- } else if (name == "CircleCollider") {
+ } else if (name == "CircleCollider2D") {
return R"JSON([
- {"key":"radius","type":"float","group":"CircleCollider"},
- {"key":"offset.x","type":"float","group":"CircleCollider"},
- {"key":"offset.y","type":"float","group":"CircleCollider"},
- {"key":"density","type":"float","group":"CircleCollider"},
- {"key":"friction","type":"float","group":"CircleCollider"},
- {"key":"restitution","type":"float","group":"CircleCollider"},
- {"key":"isSensor","type":"bool","group":"CircleCollider"},
- {"key":"enabled","type":"bool","group":"CircleCollider"},
- {"key":"categoryBits","type":"int","group":"CircleCollider"},
- {"key":"maskBits","type":"int","group":"CircleCollider"}
+ {"key":"radius","type":"float","group":"CircleCollider2D"},
+ {"key":"offset.x","type":"float","group":"CircleCollider2D"},
+ {"key":"offset.y","type":"float","group":"CircleCollider2D"},
+ {"key":"density","type":"float","group":"CircleCollider2D"},
+ {"key":"friction","type":"float","group":"CircleCollider2D"},
+ {"key":"restitution","type":"float","group":"CircleCollider2D"},
+ {"key":"isSensor","type":"bool","group":"CircleCollider2D"},
+ {"key":"enabled","type":"bool","group":"CircleCollider2D"},
+ {"key":"categoryBits","type":"int","group":"CircleCollider2D"},
+ {"key":"maskBits","type":"int","group":"CircleCollider2D"}
])JSON";
} else if (name == "ConvexCollider3D") {
return R"JSON([
@@ -436,15 +436,15 @@ std::string editor_getComponentSchema(const std::string& name) {
{"key":"falloff","type":"bool","group":"ParticleForceField"},
{"key":"enabled","type":"bool","group":"ParticleForceField"}
])JSON";
- } else if (name == "RigidBody") {
+ } else if (name == "RigidBody2D") {
return R"JSON([
- {"key":"bodyType","type":"enum","group":"RigidBody","values":["Static","Kinematic","Dynamic"]},
- {"key":"gravityScale","type":"float","group":"RigidBody"},
- {"key":"linearDamping","type":"float","group":"RigidBody"},
- {"key":"angularDamping","type":"float","group":"RigidBody"},
- {"key":"fixedRotation","type":"bool","group":"RigidBody"},
- {"key":"bullet","type":"bool","group":"RigidBody"},
- {"key":"enabled","type":"bool","group":"RigidBody"}
+ {"key":"bodyType","type":"enum","group":"RigidBody2D","values":["Static","Kinematic","Dynamic"]},
+ {"key":"gravityScale","type":"float","group":"RigidBody2D"},
+ {"key":"linearDamping","type":"float","group":"RigidBody2D"},
+ {"key":"angularDamping","type":"float","group":"RigidBody2D"},
+ {"key":"fixedRotation","type":"bool","group":"RigidBody2D"},
+ {"key":"bullet","type":"bool","group":"RigidBody2D"},
+ {"key":"enabled","type":"bool","group":"RigidBody2D"}
])JSON";
} else if (name == "RigidBody3D") {
return R"JSON([
@@ -457,19 +457,19 @@ std::string editor_getComponentSchema(const std::string& name) {
{"key":"continuousCollision","type":"bool","group":"RigidBody3D"},
{"key":"enabled","type":"bool","group":"RigidBody3D"}
])JSON";
- } else if (name == "SegmentCollider") {
+ } else if (name == "SegmentCollider2D") {
return R"JSON([
- {"key":"point1.x","type":"float","group":"SegmentCollider"},
- {"key":"point1.y","type":"float","group":"SegmentCollider"},
- {"key":"point2.x","type":"float","group":"SegmentCollider"},
- {"key":"point2.y","type":"float","group":"SegmentCollider"},
- {"key":"density","type":"float","group":"SegmentCollider"},
- {"key":"friction","type":"float","group":"SegmentCollider"},
- {"key":"restitution","type":"float","group":"SegmentCollider"},
- {"key":"isSensor","type":"bool","group":"SegmentCollider"},
- {"key":"enabled","type":"bool","group":"SegmentCollider"},
- {"key":"categoryBits","type":"int","group":"SegmentCollider"},
- {"key":"maskBits","type":"int","group":"SegmentCollider"}
+ {"key":"point1.x","type":"float","group":"SegmentCollider2D"},
+ {"key":"point1.y","type":"float","group":"SegmentCollider2D"},
+ {"key":"point2.x","type":"float","group":"SegmentCollider2D"},
+ {"key":"point2.y","type":"float","group":"SegmentCollider2D"},
+ {"key":"density","type":"float","group":"SegmentCollider2D"},
+ {"key":"friction","type":"float","group":"SegmentCollider2D"},
+ {"key":"restitution","type":"float","group":"SegmentCollider2D"},
+ {"key":"isSensor","type":"bool","group":"SegmentCollider2D"},
+ {"key":"enabled","type":"bool","group":"SegmentCollider2D"},
+ {"key":"categoryBits","type":"int","group":"SegmentCollider2D"},
+ {"key":"maskBits","type":"int","group":"SegmentCollider2D"}
])JSON";
} else if (name == "ShadowCaster2D") {
return R"JSON([
@@ -713,8 +713,8 @@ bool editor_addComponent(Registry& reg, u32 e, const std::string& name) {
if (name == "BitmapText") {
if (!reg.has<esengine::ecs::BitmapText>(entity)) reg.emplace<esengine::ecs::BitmapText>(entity);
return true;
- } else if (name == "BoxCollider") {
- if (!reg.has<esengine::ecs::BoxCollider>(entity)) reg.emplace<esengine::ecs::BoxCollider>(entity);
+ } else if (name == "BoxCollider2D") {
+ if (!reg.has<esengine::ecs::BoxCollider2D>(entity)) reg.emplace<esengine::ecs::BoxCollider2D>(entity);
return true;
} else if (name == "BoxCollider3D") {
if (!reg.has<esengine::ecs::BoxCollider3D>(entity)) reg.emplace<esengine::ecs::BoxCollider3D>(entity);
@@ -725,8 +725,8 @@ bool editor_addComponent(Registry& reg, u32 e, const std::string& name) {
} else if (name == "Canvas") {
if (!reg.has<esengine::ecs::Canvas>(entity)) reg.emplace<esengine::ecs::Canvas>(entity);
return true;
- } else if (name == "CapsuleCollider") {
- if (!reg.has<esengine::ecs::CapsuleCollider>(entity)) reg.emplace<esengine::ecs::CapsuleCollider>(entity);
+ } else if (name == "CapsuleCollider2D") {
+ if (!reg.has<esengine::ecs::CapsuleCollider2D>(entity)) reg.emplace<esengine::ecs::CapsuleCollider2D>(entity);
return true;
} else if (name == "CapsuleCollider3D") {
if (!reg.has<esengine::ecs::CapsuleCollider3D>(entity)) reg.emplace<esengine::ecs::CapsuleCollider3D>(entity);
@@ -736,8 +736,8 @@ bool editor_addComponent(Registry& reg, u32 e, const std::string& name) {
return true;
} else if (name == "Children") {
return false;
- } else if (name == "CircleCollider") {
- if (!reg.has<esengine::ecs::CircleCollider>(entity)) reg.emplace<esengine::ecs::CircleCollider>(entity);
+ } else if (name == "CircleCollider2D") {
+ if (!reg.has<esengine::ecs::CircleCollider2D>(entity)) reg.emplace<esengine::ecs::CircleCollider2D>(entity);
return true;
} else if (name == "ConvexCollider3D") {
if (!reg.has<esengine::ecs::ConvexCollider3D>(entity)) reg.emplace<esengine::ecs::ConvexCollider3D>(entity);
@@ -774,14 +774,14 @@ bool editor_addComponent(Registry& reg, u32 e, const std::string& name) {
} else if (name == "ParticleForceField") {
if (!reg.has<esengine::ecs::ParticleForceField>(entity)) reg.emplace<esengine::ecs::ParticleForceField>(entity);
return true;
- } else if (name == "RigidBody") {
- if (!reg.has<esengine::ecs::RigidBody>(entity)) reg.emplace<esengine::ecs::RigidBody>(entity);
+ } else if (name == "RigidBody2D") {
+ if (!reg.has<esengine::ecs::RigidBody2D>(entity)) reg.emplace<esengine::ecs::RigidBody2D>(entity);
return true;
} else if (name == "RigidBody3D") {
if (!reg.has<esengine::ecs::RigidBody3D>(entity)) reg.emplace<esengine::ecs::RigidBody3D>(entity);
return true;
- } else if (name == "SegmentCollider") {
- if (!reg.has<esengine::ecs::SegmentCollider>(entity)) reg.emplace<esengine::ecs::SegmentCollider>(entity);
+ } else if (name == "SegmentCollider2D") {
+ if (!reg.has<esengine::ecs::SegmentCollider2D>(entity)) reg.emplace<esengine::ecs::SegmentCollider2D>(entity);
return true;
} else if (name == "ShadowCaster2D") {
if (!reg.has<esengine::ecs::ShadowCaster2D>(entity)) reg.emplace<esengine::ecs::ShadowCaster2D>(entity);
@@ -834,16 +834,16 @@ bool editor_removeComponent(Registry& reg, u32 e, const std::string& name) {
if (!reg.valid(entity)) return false;
if (name == "BitmapText") {
if (reg.has<esengine::ecs::BitmapText>(entity)) { reg.remove<esengine::ecs::BitmapText>(entity); return true; }
- } else if (name == "BoxCollider") {
- if (reg.has<esengine::ecs::BoxCollider>(entity)) { reg.remove<esengine::ecs::BoxCollider>(entity); return true; }
+ } else if (name == "BoxCollider2D") {
+ if (reg.has<esengine::ecs::BoxCollider2D>(entity)) { reg.remove<esengine::ecs::BoxCollider2D>(entity); return true; }
} else if (name == "BoxCollider3D") {
if (reg.has<esengine::ecs::BoxCollider3D>(entity)) { reg.remove<esengine::ecs::BoxCollider3D>(entity); return true; }
} else if (name == "Camera") {
if (reg.has<esengine::ecs::Camera>(entity)) { reg.remove<esengine::ecs::Camera>(entity); return true; }
} else if (name == "Canvas") {
if (reg.has<esengine::ecs::Canvas>(entity)) { reg.remove<esengine::ecs::Canvas>(entity); return true; }
- } else if (name == "CapsuleCollider") {
- if (reg.has<esengine::ecs::CapsuleCollider>(entity)) { reg.remove<esengine::ecs::CapsuleCollider>(entity); return true; }
+ } else if (name == "CapsuleCollider2D") {
+ if (reg.has<esengine::ecs::CapsuleCollider2D>(entity)) { reg.remove<esengine::ecs::CapsuleCollider2D>(entity); return true; }
} else if (name == "CapsuleCollider3D") {
if (reg.has<esengine::ecs::CapsuleCollider3D>(entity)) { reg.remove<esengine::ecs::CapsuleCollider3D>(entity); return true; }
} else if (name == "CharacterController3D") {
@@ -854,8 +854,8 @@ bool editor_removeComponent(Registry& reg, u32 e, const std::string& name) {
for (auto child : kids) esengine::ecs::setParent(reg, child, INVALID_ENTITY);
return true;
}
- } else if (name == "CircleCollider") {
- if (reg.has<esengine::ecs::CircleCollider>(entity)) { reg.remove<esengine::ecs::CircleCollider>(entity); return true; }
+ } else if (name == "CircleCollider2D") {
+ if (reg.has<esengine::ecs::CircleCollider2D>(entity)) { reg.remove<esengine::ecs::CircleCollider2D>(entity); return true; }
} else if (name == "ConvexCollider3D") {
if (reg.has<esengine::ecs::ConvexCollider3D>(entity)) { reg.remove<esengine::ecs::ConvexCollider3D>(entity); return true; }
} else if (name == "Draggable") {
@@ -880,12 +880,12 @@ bool editor_removeComponent(Registry& reg, u32 e, const std::string& name) {
if (reg.has<esengine::ecs::ParticleEmitter>(entity)) { reg.remove<esengine::ecs::ParticleEmitter>(entity); return true; }
} else if (name == "ParticleForceField") {
if (reg.has<esengine::ecs::ParticleForceField>(entity)) { reg.remove<esengine::ecs::ParticleForceField>(entity); return true; }
- } else if (name == "RigidBody") {
- if (reg.has<esengine::ecs::RigidBody>(entity)) { reg.remove<esengine::ecs::RigidBody>(entity); return true; }
+ } else if (name == "RigidBody2D") {
+ if (reg.has<esengine::ecs::RigidBody2D>(entity)) { reg.remove<esengine::ecs::RigidBody2D>(entity); return true; }
} else if (name == "RigidBody3D") {
if (reg.has<esengine::ecs::RigidBody3D>(entity)) { reg.remove<esengine::ecs::RigidBody3D>(entity); return true; }
- } else if (name == "SegmentCollider") {
- if (reg.has<esengine::ecs::SegmentCollider>(entity)) { reg.remove<esengine::ecs::SegmentCollider>(entity); return true; }
+ } else if (name == "SegmentCollider2D") {
+ if (reg.has<esengine::ecs::SegmentCollider2D>(entity)) { reg.remove<esengine::ecs::SegmentCollider2D>(entity); return true; }
} else if (name == "ShadowCaster2D") {
if (reg.has<esengine::ecs::ShadowCaster2D>(entity)) { reg.remove<esengine::ecs::ShadowCaster2D>(entity); return true; }
} else if (name == "ShapeRenderer") {
@@ -922,15 +922,15 @@ bool editor_hasComponent(Registry& reg, u32 e, const std::string& name) {
auto entity = static_cast<Entity>(e);
if (!reg.valid(entity)) return false;
if (name == "BitmapText") return reg.has<esengine::ecs::BitmapText>(entity);
- if (name == "BoxCollider") return reg.has<esengine::ecs::BoxCollider>(entity);
+ if (name == "BoxCollider2D") return reg.has<esengine::ecs::BoxCollider2D>(entity);
if (name == "BoxCollider3D") return reg.has<esengine::ecs::BoxCollider3D>(entity);
if (name == "Camera") return reg.has<esengine::ecs::Camera>(entity);
if (name == "Canvas") return reg.has<esengine::ecs::Canvas>(entity);
- if (name == "CapsuleCollider") return reg.has<esengine::ecs::CapsuleCollider>(entity);
+ if (name == "CapsuleCollider2D") return reg.has<esengine::ecs::CapsuleCollider2D>(entity);
if (name == "CapsuleCollider3D") return reg.has<esengine::ecs::CapsuleCollider3D>(entity);
if (name == "CharacterController3D") return reg.has<esengine::ecs::CharacterController3D>(entity);
if (name == "Children") return reg.has<esengine::ecs::Children>(entity);
- if (name == "CircleCollider") return reg.has<esengine::ecs::CircleCollider>(entity);
+ if (name == "CircleCollider2D") return reg.has<esengine::ecs::CircleCollider2D>(entity);
if (name == "ConvexCollider3D") return reg.has<esengine::ecs::ConvexCollider3D>(entity);
if (name == "Draggable") return reg.has<esengine::ecs::Draggable>(entity);
if (name == "DragonBonesAnimation") return reg.has<esengine::ecs::DragonBonesAnimation>(entity);
@@ -943,9 +943,9 @@ bool editor_hasComponent(Registry& reg, u32 e, const std::string& name) {
if (name == "Parent") return reg.has<esengine::ecs::Parent>(entity);
if (name == "ParticleEmitter") return reg.has<esengine::ecs::ParticleEmitter>(entity);
if (name == "ParticleForceField") return reg.has<esengine::ecs::ParticleForceField>(entity);
- if (name == "RigidBody") return reg.has<esengine::ecs::RigidBody>(entity);
+ if (name == "RigidBody2D") return reg.has<esengine::ecs::RigidBody2D>(entity);
if (name == "RigidBody3D") return reg.has<esengine::ecs::RigidBody3D>(entity);
- if (name == "SegmentCollider") return reg.has<esengine::ecs::SegmentCollider>(entity);
+ if (name == "SegmentCollider2D") return reg.has<esengine::ecs::SegmentCollider2D>(entity);
if (name == "ShadowCaster2D") return reg.has<esengine::ecs::ShadowCaster2D>(entity);
if (name == "ShapeRenderer") return reg.has<esengine::ecs::ShapeRenderer>(entity);
if (name == "SphereCollider3D") return reg.has<esengine::ecs::SphereCollider3D>(entity);
@@ -970,15 +970,15 @@ std::vector<std::string> editor_getComponents(Registry& reg, u32 e) {
std::vector<std::string> result;
if (!reg.valid(entity)) return result;
if (reg.has<esengine::ecs::BitmapText>(entity)) result.push_back("BitmapText");
- if (reg.has<esengine::ecs::BoxCollider>(entity)) result.push_back("BoxCollider");
+ if (reg.has<esengine::ecs::BoxCollider2D>(entity)) result.push_back("BoxCollider2D");
if (reg.has<esengine::ecs::BoxCollider3D>(entity)) result.push_back("BoxCollider3D");
if (reg.has<esengine::ecs::Camera>(entity)) result.push_back("Camera");
if (reg.has<esengine::ecs::Canvas>(entity)) result.push_back("Canvas");
- if (reg.has<esengine::ecs::CapsuleCollider>(entity)) result.push_back("CapsuleCollider");
+ if (reg.has<esengine::ecs::CapsuleCollider2D>(entity)) result.push_back("CapsuleCollider2D");
if (reg.has<esengine::ecs::CapsuleCollider3D>(entity)) result.push_back("CapsuleCollider3D");
if (reg.has<esengine::ecs::CharacterController3D>(entity)) result.push_back("CharacterController3D");
if (reg.has<esengine::ecs::Children>(entity)) result.push_back("Children");
- if (reg.has<esengine::ecs::CircleCollider>(entity)) result.push_back("CircleCollider");
+ if (reg.has<esengine::ecs::CircleCollider2D>(entity)) result.push_back("CircleCollider2D");
if (reg.has<esengine::ecs::ConvexCollider3D>(entity)) result.push_back("ConvexCollider3D");
if (reg.has<esengine::ecs::Draggable>(entity)) result.push_back("Draggable");
if (reg.has<esengine::ecs::DragonBonesAnimation>(entity)) result.push_back("DragonBonesAnimation");
@@ -991,9 +991,9 @@ std::vector<std::string> editor_getComponents(Registry& reg, u32 e) {
if (reg.has<esengine::ecs::Parent>(entity)) result.push_back("Parent");
if (reg.has<esengine::ecs::ParticleEmitter>(entity)) result.push_back("ParticleEmitter");
if (reg.has<esengine::ecs::ParticleForceField>(entity)) result.push_back("ParticleForceField");
- if (reg.has<esengine::ecs::RigidBody>(entity)) result.push_back("RigidBody");
+ if (reg.has<esengine::ecs::RigidBody2D>(entity)) result.push_back("RigidBody2D");
if (reg.has<esengine::ecs::RigidBody3D>(entity)) result.push_back("RigidBody3D");
- if (reg.has<esengine::ecs::SegmentCollider>(entity)) result.push_back("SegmentCollider");
+ if (reg.has<esengine::ecs::SegmentCollider2D>(entity)) result.push_back("SegmentCollider2D");
if (reg.has<esengine::ecs::ShadowCaster2D>(entity)) result.push_back("ShadowCaster2D");
if (reg.has<esengine::ecs::ShapeRenderer>(entity)) result.push_back("ShapeRenderer");
if (reg.has<esengine::ecs::SphereCollider3D>(entity)) result.push_back("SphereCollider3D");
@@ -1029,9 +1029,9 @@ bool editor_setFloat(Registry& reg, u32 e, const std::string& comp, const std::s
else if (field == "parallax.y") { c.parallax.y = value; }
else { return false; }
return true;
- } else if (comp == "BoxCollider") {
- if (!reg.has<esengine::ecs::BoxCollider>(entity)) return false;
- auto& c = reg.get<esengine::ecs::BoxCollider>(entity);
+ } else if (comp == "BoxCollider2D") {
+ if (!reg.has<esengine::ecs::BoxCollider2D>(entity)) return false;
+ auto& c = reg.get<esengine::ecs::BoxCollider2D>(entity);
if (field == "halfExtents.x") { c.halfExtents.x = value; }
else if (field == "halfExtents.y") { c.halfExtents.y = value; }
else if (field == "offset.x") { c.offset.x = value; }
@@ -1076,9 +1076,9 @@ bool editor_setFloat(Registry& reg, u32 e, const std::string& comp, const std::s
else if (field == "backgroundColor.a") { c.backgroundColor.a = value; }
else { return false; }
return true;
- } else if (comp == "CapsuleCollider") {
- if (!reg.has<esengine::ecs::CapsuleCollider>(entity)) return false;
- auto& c = reg.get<esengine::ecs::CapsuleCollider>(entity);
+ } else if (comp == "CapsuleCollider2D") {
+ if (!reg.has<esengine::ecs::CapsuleCollider2D>(entity)) return false;
+ auto& c = reg.get<esengine::ecs::CapsuleCollider2D>(entity);
if (field == "radius") { c.radius = value; }
else if (field == "halfHeight") { c.halfHeight = value; }
else if (field == "offset.x") { c.offset.x = value; }
@@ -1118,9 +1118,9 @@ bool editor_setFloat(Registry& reg, u32 e, const std::string& comp, const std::s
else if (field == "realVelocity.z") { c.realVelocity.z = value; }
else { return false; }
return true;
- } else if (comp == "CircleCollider") {
- if (!reg.has<esengine::ecs::CircleCollider>(entity)) return false;
- auto& c = reg.get<esengine::ecs::CircleCollider>(entity);
+ } else if (comp == "CircleCollider2D") {
+ if (!reg.has<esengine::ecs::CircleCollider2D>(entity)) return false;
+ auto& c = reg.get<esengine::ecs::CircleCollider2D>(entity);
if (field == "radius") { c.radius = value; }
else if (field == "offset.x") { c.offset.x = value; }
else if (field == "offset.y") { c.offset.y = value; }
@@ -1265,9 +1265,9 @@ bool editor_setFloat(Registry& reg, u32 e, const std::string& comp, const std::s
else if (field == "direction.z") { c.direction.z = value; }
else { return false; }
return true;
- } else if (comp == "RigidBody") {
- if (!reg.has<esengine::ecs::RigidBody>(entity)) return false;
- auto& c = reg.get<esengine::ecs::RigidBody>(entity);
+ } else if (comp == "RigidBody2D") {
+ if (!reg.has<esengine::ecs::RigidBody2D>(entity)) return false;
+ auto& c = reg.get<esengine::ecs::RigidBody2D>(entity);
if (field == "gravityScale") { c.gravityScale = value; }
else if (field == "linearDamping") { c.linearDamping = value; }
else if (field == "angularDamping") { c.angularDamping = value; }
@@ -1281,9 +1281,9 @@ bool editor_setFloat(Registry& reg, u32 e, const std::string& comp, const std::s
else if (field == "angularDamping") { c.angularDamping = value; }
else { return false; }
return true;
- } else if (comp == "SegmentCollider") {
- if (!reg.has<esengine::ecs::SegmentCollider>(entity)) return false;
- auto& c = reg.get<esengine::ecs::SegmentCollider>(entity);
+ } else if (comp == "SegmentCollider2D") {
+ if (!reg.has<esengine::ecs::SegmentCollider2D>(entity)) return false;
+ auto& c = reg.get<esengine::ecs::SegmentCollider2D>(entity);
if (field == "point1.x") { c.point1.x = value; }
else if (field == "point1.y") { c.point1.y = value; }
else if (field == "point2.x") { c.point2.x = value; }
@@ -1518,9 +1518,9 @@ f32 editor_getFloat(Registry& reg, u32 e, const std::string& comp, const std::st
else if (field == "spacing") { return c.spacing; }
else if (field == "parallax.x") { return c.parallax.x; }
else if (field == "parallax.y") { return c.parallax.y; }
- } else if (comp == "BoxCollider") {
- if (!reg.has<esengine::ecs::BoxCollider>(entity)) return 0.0f;
- const auto& c = reg.get<esengine::ecs::BoxCollider>(entity);
+ } else if (comp == "BoxCollider2D") {
+ if (!reg.has<esengine::ecs::BoxCollider2D>(entity)) return 0.0f;
+ const auto& c = reg.get<esengine::ecs::BoxCollider2D>(entity);
if (field == "halfExtents.x") { return c.halfExtents.x; }
else if (field == "halfExtents.y") { return c.halfExtents.y; }
else if (field == "offset.x") { return c.offset.x; }
@@ -1557,9 +1557,9 @@ f32 editor_getFloat(Registry& reg, u32 e, const std::string& comp, const std::st
else if (field == "backgroundColor.g") { return c.backgroundColor.g; }
else if (field == "backgroundColor.b") { return c.backgroundColor.b; }
else if (field == "backgroundColor.a") { return c.backgroundColor.a; }
- } else if (comp == "CapsuleCollider") {
- if (!reg.has<esengine::ecs::CapsuleCollider>(entity)) return 0.0f;
- const auto& c = reg.get<esengine::ecs::CapsuleCollider>(entity);
+ } else if (comp == "CapsuleCollider2D") {
+ if (!reg.has<esengine::ecs::CapsuleCollider2D>(entity)) return 0.0f;
+ const auto& c = reg.get<esengine::ecs::CapsuleCollider2D>(entity);
if (field == "radius") { return c.radius; }
else if (field == "halfHeight") { return c.halfHeight; }
else if (field == "offset.x") { return c.offset.x; }
@@ -1593,9 +1593,9 @@ f32 editor_getFloat(Registry& reg, u32 e, const std::string& comp, const std::st
else if (field == "realVelocity.x") { return c.realVelocity.x; }
else if (field == "realVelocity.y") { return c.realVelocity.y; }
else if (field == "realVelocity.z") { return c.realVelocity.z; }
- } else if (comp == "CircleCollider") {
- if (!reg.has<esengine::ecs::CircleCollider>(entity)) return 0.0f;
- const auto& c = reg.get<esengine::ecs::CircleCollider>(entity);
+ } else if (comp == "CircleCollider2D") {
+ if (!reg.has<esengine::ecs::CircleCollider2D>(entity)) return 0.0f;
+ const auto& c = reg.get<esengine::ecs::CircleCollider2D>(entity);
if (field == "radius") { return c.radius; }
else if (field == "offset.x") { return c.offset.x; }
else if (field == "offset.y") { return c.offset.y; }
@@ -1720,9 +1720,9 @@ f32 editor_getFloat(Registry& reg, u32 e, const std::string& comp, const std::st
else if (field == "direction.x") { return c.direction.x; }
else if (field == "direction.y") { return c.direction.y; }
else if (field == "direction.z") { return c.direction.z; }
- } else if (comp == "RigidBody") {
- if (!reg.has<esengine::ecs::RigidBody>(entity)) return 0.0f;
- const auto& c = reg.get<esengine::ecs::RigidBody>(entity);
+ } else if (comp == "RigidBody2D") {
+ if (!reg.has<esengine::ecs::RigidBody2D>(entity)) return 0.0f;
+ const auto& c = reg.get<esengine::ecs::RigidBody2D>(entity);
if (field == "gravityScale") { return c.gravityScale; }
else if (field == "linearDamping") { return c.linearDamping; }
else if (field == "angularDamping") { return c.angularDamping; }
@@ -1732,9 +1732,9 @@ f32 editor_getFloat(Registry& reg, u32 e, const std::string& comp, const std::st
if (field == "gravityScale") { return c.gravityScale; }
else if (field == "linearDamping") { return c.linearDamping; }
else if (field == "angularDamping") { return c.angularDamping; }
- } else if (comp == "SegmentCollider") {
- if (!reg.has<esengine::ecs::SegmentCollider>(entity)) return 0.0f;
- const auto& c = reg.get<esengine::ecs::SegmentCollider>(entity);
+ } else if (comp == "SegmentCollider2D") {
+ if (!reg.has<esengine::ecs::SegmentCollider2D>(entity)) return 0.0f;
+ const auto& c = reg.get<esengine::ecs::SegmentCollider2D>(entity);
if (field == "point1.x") { return c.point1.x; }
else if (field == "point1.y") { return c.point1.y; }
else if (field == "point2.x") { return c.point2.x; }
@@ -1926,9 +1926,9 @@ bool editor_setInt(Registry& reg, u32 e, const std::string& comp, const std::str
else if (field == "font") { c.font = resource::BitmapFontHandle(static_cast<u32>(value)); }
else { return false; }
return true;
- } else if (comp == "BoxCollider") {
- if (!reg.has<esengine::ecs::BoxCollider>(entity)) return false;
- auto& c = reg.get<esengine::ecs::BoxCollider>(entity);
+ } else if (comp == "BoxCollider2D") {
+ if (!reg.has<esengine::ecs::BoxCollider2D>(entity)) return false;
+ auto& c = reg.get<esengine::ecs::BoxCollider2D>(entity);
if (field == "categoryBits") { c.categoryBits = static_cast<u32>(value); }
else if (field == "maskBits") { c.maskBits = static_cast<u32>(value); }
else { return false; }
@@ -1950,9 +1950,9 @@ bool editor_setInt(Registry& reg, u32 e, const std::string& comp, const std::str
else if (field == "layer") { c.layer = static_cast<i32>(value); }
else { return false; }
return true;
- } else if (comp == "CapsuleCollider") {
- if (!reg.has<esengine::ecs::CapsuleCollider>(entity)) return false;
- auto& c = reg.get<esengine::ecs::CapsuleCollider>(entity);
+ } else if (comp == "CapsuleCollider2D") {
+ if (!reg.has<esengine::ecs::CapsuleCollider2D>(entity)) return false;
+ auto& c = reg.get<esengine::ecs::CapsuleCollider2D>(entity);
if (field == "categoryBits") { c.categoryBits = static_cast<u32>(value); }
else if (field == "maskBits") { c.maskBits = static_cast<u32>(value); }
else { return false; }
@@ -1963,9 +1963,9 @@ bool editor_setInt(Registry& reg, u32 e, const std::string& comp, const std::str
if (field == "layer") { c.layer = static_cast<u32>(value); }
else { return false; }
return true;
- } else if (comp == "CircleCollider") {
- if (!reg.has<esengine::ecs::CircleCollider>(entity)) return false;
- auto& c = reg.get<esengine::ecs::CircleCollider>(entity);
+ } else if (comp == "CircleCollider2D") {
+ if (!reg.has<esengine::ecs::CircleCollider2D>(entity)) return false;
+ auto& c = reg.get<esengine::ecs::CircleCollider2D>(entity);
if (field == "categoryBits") { c.categoryBits = static_cast<u32>(value); }
else if (field == "maskBits") { c.maskBits = static_cast<u32>(value); }
else { return false; }
@@ -2048,9 +2048,9 @@ bool editor_setInt(Registry& reg, u32 e, const std::string& comp, const std::str
if (field == "type") { c.type = static_cast<i32>(value); }
else { return false; }
return true;
- } else if (comp == "RigidBody") {
- if (!reg.has<esengine::ecs::RigidBody>(entity)) return false;
- auto& c = reg.get<esengine::ecs::RigidBody>(entity);
+ } else if (comp == "RigidBody2D") {
+ if (!reg.has<esengine::ecs::RigidBody2D>(entity)) return false;
+ auto& c = reg.get<esengine::ecs::RigidBody2D>(entity);
if (field == "bodyType") { c.bodyType = static_cast<BodyType>(value); }
else { return false; }
return true;
@@ -2061,9 +2061,9 @@ bool editor_setInt(Registry& reg, u32 e, const std::string& comp, const std::str
else if (field == "layer") { c.layer = static_cast<u32>(value); }
else { return false; }
return true;
- } else if (comp == "SegmentCollider") {
- if (!reg.has<esengine::ecs::SegmentCollider>(entity)) return false;
- auto& c = reg.get<esengine::ecs::SegmentCollider>(entity);
+ } else if (comp == "SegmentCollider2D") {
+ if (!reg.has<esengine::ecs::SegmentCollider2D>(entity)) return false;
+ auto& c = reg.get<esengine::ecs::SegmentCollider2D>(entity);
if (field == "categoryBits") { c.categoryBits = static_cast<u32>(value); }
else if (field == "maskBits") { c.maskBits = static_cast<u32>(value); }
else { return false; }
@@ -2158,9 +2158,9 @@ i32 editor_getInt(Registry& reg, u32 e, const std::string& comp, const std::stri
if (field == "align") { return static_cast<i32>(c.align); }
else if (field == "layer") { return static_cast<i32>(c.layer); }
else if (field == "font") { return static_cast<i32>(c.font.id()); }
- } else if (comp == "BoxCollider") {
- if (!reg.has<esengine::ecs::BoxCollider>(entity)) return 0;
- const auto& c = reg.get<esengine::ecs::BoxCollider>(entity);
+ } else if (comp == "BoxCollider2D") {
+ if (!reg.has<esengine::ecs::BoxCollider2D>(entity)) return 0;
+ const auto& c = reg.get<esengine::ecs::BoxCollider2D>(entity);
if (field == "categoryBits") { return static_cast<i32>(c.categoryBits); }
else if (field == "maskBits") { return static_cast<i32>(c.maskBits); }
} else if (comp == "Camera") {
@@ -2176,18 +2176,18 @@ i32 editor_getInt(Registry& reg, u32 e, const std::string& comp, const std::stri
const auto& c = reg.get<esengine::ecs::Canvas>(entity);
if (field == "scaleMode") { return static_cast<i32>(c.scaleMode); }
else if (field == "layer") { return static_cast<i32>(c.layer); }
- } else if (comp == "CapsuleCollider") {
- if (!reg.has<esengine::ecs::CapsuleCollider>(entity)) return 0;
- const auto& c = reg.get<esengine::ecs::CapsuleCollider>(entity);
+ } else if (comp == "CapsuleCollider2D") {
+ if (!reg.has<esengine::ecs::CapsuleCollider2D>(entity)) return 0;
+ const auto& c = reg.get<esengine::ecs::CapsuleCollider2D>(entity);
if (field == "categoryBits") { return static_cast<i32>(c.categoryBits); }
else if (field == "maskBits") { return static_cast<i32>(c.maskBits); }
} else if (comp == "CharacterController3D") {
if (!reg.has<esengine::ecs::CharacterController3D>(entity)) return 0;
const auto& c = reg.get<esengine::ecs::CharacterController3D>(entity);
if (field == "layer") { return static_cast<i32>(c.layer); }
- } else if (comp == "CircleCollider") {
- if (!reg.has<esengine::ecs::CircleCollider>(entity)) return 0;
- const auto& c = reg.get<esengine::ecs::CircleCollider>(entity);
+ } else if (comp == "CircleCollider2D") {
+ if (!reg.has<esengine::ecs::CircleCollider2D>(entity)) return 0;
+ const auto& c = reg.get<esengine::ecs::CircleCollider2D>(entity);
if (field == "categoryBits") { return static_cast<i32>(c.categoryBits); }
else if (field == "maskBits") { return static_cast<i32>(c.maskBits); }
} else if (comp == "ConvexCollider3D") {
@@ -2252,18 +2252,18 @@ i32 editor_getInt(Registry& reg, u32 e, const std::string& comp, const std::stri
if (!reg.has<esengine::ecs::ParticleForceField>(entity)) return 0;
const auto& c = reg.get<esengine::ecs::ParticleForceField>(entity);
if (field == "type") { return static_cast<i32>(c.type); }
- } else if (comp == "RigidBody") {
- if (!reg.has<esengine::ecs::RigidBody>(entity)) return 0;
- const auto& c = reg.get<esengine::ecs::RigidBody>(entity);
+ } else if (comp == "RigidBody2D") {
+ if (!reg.has<esengine::ecs::RigidBody2D>(entity)) return 0;
+ const auto& c = reg.get<esengine::ecs::RigidBody2D>(entity);
if (field == "bodyType") { return static_cast<i32>(c.bodyType); }
} else if (comp == "RigidBody3D") {
if (!reg.has<esengine::ecs::RigidBody3D>(entity)) return 0;
const auto& c = reg.get<esengine::ecs::RigidBody3D>(entity);
if (field == "bodyType") { return static_cast<i32>(c.bodyType); }
else if (field == "layer") { return static_cast<i32>(c.layer); }
- } else if (comp == "SegmentCollider") {
- if (!reg.has<esengine::ecs::SegmentCollider>(entity)) return 0;
- const auto& c = reg.get<esengine::ecs::SegmentCollider>(entity);
+ } else if (comp == "SegmentCollider2D") {
+ if (!reg.has<esengine::ecs::SegmentCollider2D>(entity)) return 0;
+ const auto& c = reg.get<esengine::ecs::SegmentCollider2D>(entity);
if (field == "categoryBits") { return static_cast<i32>(c.categoryBits); }
else if (field == "maskBits") { return static_cast<i32>(c.maskBits); }
} else if (comp == "ShapeRenderer") {
@@ -2338,9 +2338,9 @@ bool editor_setBool(Registry& reg, u32 e, const std::string& comp, const std::st
if (field == "enabled") { c.enabled = value; }
else { return false; }
return true;
- } else if (comp == "BoxCollider") {
- if (!reg.has<esengine::ecs::BoxCollider>(entity)) return false;
- auto& c = reg.get<esengine::ecs::BoxCollider>(entity);
+ } else if (comp == "BoxCollider2D") {
+ if (!reg.has<esengine::ecs::BoxCollider2D>(entity)) return false;
+ auto& c = reg.get<esengine::ecs::BoxCollider2D>(entity);
if (field == "isSensor") { c.isSensor = value; }
else if (field == "enabled") { c.enabled = value; }
else { return false; }
@@ -2359,9 +2359,9 @@ bool editor_setBool(Registry& reg, u32 e, const std::string& comp, const std::st
else if (field == "pixelPerfect") { c.pixelPerfect = value; }
else { return false; }
return true;
- } else if (comp == "CapsuleCollider") {
- if (!reg.has<esengine::ecs::CapsuleCollider>(entity)) return false;
- auto& c = reg.get<esengine::ecs::CapsuleCollider>(entity);
+ } else if (comp == "CapsuleCollider2D") {
+ if (!reg.has<esengine::ecs::CapsuleCollider2D>(entity)) return false;
+ auto& c = reg.get<esengine::ecs::CapsuleCollider2D>(entity);
if (field == "isSensor") { c.isSensor = value; }
else if (field == "enabled") { c.enabled = value; }
else { return false; }
@@ -2380,9 +2380,9 @@ bool editor_setBool(Registry& reg, u32 e, const std::string& comp, const std::st
else if (field == "isOnFloor") { c.isOnFloor = value; }
else { return false; }
return true;
- } else if (comp == "CircleCollider") {
- if (!reg.has<esengine::ecs::CircleCollider>(entity)) return false;
- auto& c = reg.get<esengine::ecs::CircleCollider>(entity);
+ } else if (comp == "CircleCollider2D") {
+ if (!reg.has<esengine::ecs::CircleCollider2D>(entity)) return false;
+ auto& c = reg.get<esengine::ecs::CircleCollider2D>(entity);
if (field == "isSensor") { c.isSensor = value; }
else if (field == "enabled") { c.enabled = value; }
else { return false; }
@@ -2463,9 +2463,9 @@ bool editor_setBool(Registry& reg, u32 e, const std::string& comp, const std::st
else if (field == "enabled") { c.enabled = value; }
else { return false; }
return true;
- } else if (comp == "RigidBody") {
- if (!reg.has<esengine::ecs::RigidBody>(entity)) return false;
- auto& c = reg.get<esengine::ecs::RigidBody>(entity);
+ } else if (comp == "RigidBody2D") {
+ if (!reg.has<esengine::ecs::RigidBody2D>(entity)) return false;
+ auto& c = reg.get<esengine::ecs::RigidBody2D>(entity);
if (field == "fixedRotation") { c.fixedRotation = value; }
else if (field == "bullet") { c.bullet = value; }
else if (field == "enabled") { c.enabled = value; }
@@ -2479,9 +2479,9 @@ bool editor_setBool(Registry& reg, u32 e, const std::string& comp, const std::st
else if (field == "enabled") { c.enabled = value; }
else { return false; }
return true;
- } else if (comp == "SegmentCollider") {
- if (!reg.has<esengine::ecs::SegmentCollider>(entity)) return false;
- auto& c = reg.get<esengine::ecs::SegmentCollider>(entity);
+ } else if (comp == "SegmentCollider2D") {
+ if (!reg.has<esengine::ecs::SegmentCollider2D>(entity)) return false;
+ auto& c = reg.get<esengine::ecs::SegmentCollider2D>(entity);
if (field == "isSensor") { c.isSensor = value; }
else if (field == "enabled") { c.enabled = value; }
else { return false; }
@@ -2580,9 +2580,9 @@ bool editor_getBool(Registry& reg, u32 e, const std::string& comp, const std::st
if (!reg.has<esengine::ecs::BitmapText>(entity)) return false;
const auto& c = reg.get<esengine::ecs::BitmapText>(entity);
if (field == "enabled") { return c.enabled; }
- } else if (comp == "BoxCollider") {
- if (!reg.has<esengine::ecs::BoxCollider>(entity)) return false;
- const auto& c = reg.get<esengine::ecs::BoxCollider>(entity);
+ } else if (comp == "BoxCollider2D") {
+ if (!reg.has<esengine::ecs::BoxCollider2D>(entity)) return false;
+ const auto& c = reg.get<esengine::ecs::BoxCollider2D>(entity);
if (field == "isSensor") { return c.isSensor; }
else if (field == "enabled") { return c.enabled; }
} else if (comp == "BoxCollider3D") {
@@ -2595,9 +2595,9 @@ bool editor_getBool(Registry& reg, u32 e, const std::string& comp, const std::st
const auto& c = reg.get<esengine::ecs::Camera>(entity);
if (field == "isActive") { return c.isActive; }
else if (field == "pixelPerfect") { return c.pixelPerfect; }
- } else if (comp == "CapsuleCollider") {
- if (!reg.has<esengine::ecs::CapsuleCollider>(entity)) return false;
- const auto& c = reg.get<esengine::ecs::CapsuleCollider>(entity);
+ } else if (comp == "CapsuleCollider2D") {
+ if (!reg.has<esengine::ecs::CapsuleCollider2D>(entity)) return false;
+ const auto& c = reg.get<esengine::ecs::CapsuleCollider2D>(entity);
if (field == "isSensor") { return c.isSensor; }
else if (field == "enabled") { return c.enabled; }
} else if (comp == "CapsuleCollider3D") {
@@ -2610,9 +2610,9 @@ bool editor_getBool(Registry& reg, u32 e, const std::string& comp, const std::st
const auto& c = reg.get<esengine::ecs::CharacterController3D>(entity);
if (field == "enabled") { return c.enabled; }
else if (field == "isOnFloor") { return c.isOnFloor; }
- } else if (comp == "CircleCollider") {
- if (!reg.has<esengine::ecs::CircleCollider>(entity)) return false;
- const auto& c = reg.get<esengine::ecs::CircleCollider>(entity);
+ } else if (comp == "CircleCollider2D") {
+ if (!reg.has<esengine::ecs::CircleCollider2D>(entity)) return false;
+ const auto& c = reg.get<esengine::ecs::CircleCollider2D>(entity);
if (field == "isSensor") { return c.isSensor; }
else if (field == "enabled") { return c.enabled; }
} else if (comp == "ConvexCollider3D") {
@@ -2673,9 +2673,9 @@ bool editor_getBool(Registry& reg, u32 e, const std::string& comp, const std::st
const auto& c = reg.get<esengine::ecs::ParticleForceField>(entity);
if (field == "falloff") { return c.falloff; }
else if (field == "enabled") { return c.enabled; }
- } else if (comp == "RigidBody") {
- if (!reg.has<esengine::ecs::RigidBody>(entity)) return false;
- const auto& c = reg.get<esengine::ecs::RigidBody>(entity);
+ } else if (comp == "RigidBody2D") {
+ if (!reg.has<esengine::ecs::RigidBody2D>(entity)) return false;
+ const auto& c = reg.get<esengine::ecs::RigidBody2D>(entity);
if (field == "fixedRotation") { return c.fixedRotation; }
else if (field == "bullet") { return c.bullet; }
else if (field == "enabled") { return c.enabled; }
@@ -2685,9 +2685,9 @@ bool editor_getBool(Registry& reg, u32 e, const std::string& comp, const std::st
if (field == "fixedRotation") { return c.fixedRotation; }
else if (field == "continuousCollision") { return c.continuousCollision; }
else if (field == "enabled") { return c.enabled; }
- } else if (comp == "SegmentCollider") {
- if (!reg.has<esengine::ecs::SegmentCollider>(entity)) return false;
- const auto& c = reg.get<esengine::ecs::SegmentCollider>(entity);
+ } else if (comp == "SegmentCollider2D") {
+ if (!reg.has<esengine::ecs::SegmentCollider2D>(entity)) return false;
+ const auto& c = reg.get<esengine::ecs::SegmentCollider2D>(entity);
if (field == "isSensor") { return c.isSensor; }
else if (field == "enabled") { return c.enabled; }
} else if (comp == "ShadowCaster2D") {
diff --git a/src/esengine/bindings/WebBindings.generated.cpp b/src/esengine/bindings/WebBindings.generated.cpp
index 127d24acc..3e36cfde5 100644
--- a/src/esengine/bindings/WebBindings.generated.cpp
+++ b/src/esengine/bindings/WebBindings.generated.cpp
@@ -14,7 +14,7 @@
#include "../ecs/components/BitmapText.hpp"
#include "../ecs/components/Camera.hpp"
#include "../ecs/components/Canvas.hpp"
-#include "../ecs/components/Collider.hpp"
+#include "../ecs/components/Collider2D.hpp"
#include "../ecs/components/Draggable.hpp"
#include "../ecs/components/DragonBonesAnimation.hpp"
#include "../ecs/components/FlexContainer.hpp"
@@ -24,7 +24,7 @@
#include "../ecs/components/MeshRenderer.hpp"
#include "../ecs/components/ParticleEmitter.hpp"
#include "../ecs/components/ParticleForceField.hpp"
-#include "../ecs/components/RigidBody.hpp"
+#include "../ecs/components/RigidBody2D.hpp"
#include "../ecs/components/RigidBody3D.hpp"
#include "../ecs/components/ShadowCaster2D.hpp"
#include "../ecs/components/ShapeRenderer.hpp"
@@ -839,7 +839,7 @@ ParticleEmitterJS particleemitterToJS(const esengine::ecs::ParticleEmitter& c) {
return js;
}
-struct RigidBodyJS {
+struct RigidBody2DJS {
i32 bodyType;
f32 gravityScale;
f32 linearDamping;
@@ -849,7 +849,7 @@ struct RigidBodyJS {
bool enabled;
};
-void rigidbodyApplyJS(esengine::ecs::RigidBody& c, const RigidBodyJS& js) {
+void rigidbody2dApplyJS(esengine::ecs::RigidBody2D& c, const RigidBody2DJS& js) {
c.bodyType = static_cast<BodyType>(js.bodyType);
c.gravityScale = js.gravityScale;
c.linearDamping = js.linearDamping;
@@ -859,14 +859,14 @@ void rigidbodyApplyJS(esengine::ecs::RigidBody& c, const RigidBodyJS& js) {
c.enabled = js.enabled;
}
-esengine::ecs::RigidBody rigidbodyFromJS(const RigidBodyJS& js) {
- esengine::ecs::RigidBody c;
- rigidbodyApplyJS(c, js);
+esengine::ecs::RigidBody2D rigidbody2dFromJS(const RigidBody2DJS& js) {
+ esengine::ecs::RigidBody2D c;
+ rigidbody2dApplyJS(c, js);
return c;
}
-RigidBodyJS rigidbodyToJS(const esengine::ecs::RigidBody& c) {
- RigidBodyJS js;
+RigidBody2DJS rigidbody2dToJS(const esengine::ecs::RigidBody2D& c) {
+ RigidBody2DJS js;
js.bodyType = static_cast<i32>(c.bodyType);
js.gravityScale = c.gravityScale;
js.linearDamping = c.linearDamping;
@@ -1309,16 +1309,16 @@ EMSCRIPTEN_BINDINGS(esengine_components) {
.field("font", &BitmapTextJS::font)
.field("enabled", &BitmapTextJS::enabled);
- value_object<esengine::ecs::BoxCollider>("BoxCollider")
- .field("halfExtents", &esengine::ecs::BoxCollider::halfExtents)
- .field("offset", &esengine::ecs::BoxCollider::offset)
- .field("density", &esengine::ecs::BoxCollider::density)
- .field("friction", &esengine::ecs::BoxCollider::friction)
- .field("restitution", &esengine::ecs::BoxCollider::restitution)
- .field("isSensor", &esengine::ecs::BoxCollider::isSensor)
- .field("enabled", &esengine::ecs::BoxCollider::enabled)
- .field("categoryBits", &esengine::ecs::BoxCollider::categoryBits)
- .field("maskBits", &esengine::ecs::BoxCollider::maskBits);
+ value_object<esengine::ecs::BoxCollider2D>("BoxCollider2D")
+ .field("halfExtents", &esengine::ecs::BoxCollider2D::halfExtents)
+ .field("offset", &esengine::ecs::BoxCollider2D::offset)
+ .field("density", &esengine::ecs::BoxCollider2D::density)
+ .field("friction", &esengine::ecs::BoxCollider2D::friction)
+ .field("restitution", &esengine::ecs::BoxCollider2D::restitution)
+ .field("isSensor", &esengine::ecs::BoxCollider2D::isSensor)
+ .field("enabled", &esengine::ecs::BoxCollider2D::enabled)
+ .field("categoryBits", &esengine::ecs::BoxCollider2D::categoryBits)
+ .field("maskBits", &esengine::ecs::BoxCollider2D::maskBits);
value_object<esengine::ecs::BoxCollider3D>("BoxCollider3D")
.field("halfExtents", &esengine::ecs::BoxCollider3D::halfExtents)
@@ -1350,17 +1350,17 @@ EMSCRIPTEN_BINDINGS(esengine_components) {
.field("backgroundColor", &CanvasJS::backgroundColor)
.field("layer", &CanvasJS::layer);
- value_object<esengine::ecs::CapsuleCollider>("CapsuleCollider")
- .field("radius", &esengine::ecs::CapsuleCollider::radius)
- .field("halfHeight", &esengine::ecs::CapsuleCollider::halfHeight)
- .field("offset", &esengine::ecs::CapsuleCollider::offset)
- .field("density", &esengine::ecs::CapsuleCollider::density)
- .field("friction", &esengine::ecs::CapsuleCollider::friction)
- .field("restitution", &esengine::ecs::CapsuleCollider::restitution)
- .field("isSensor", &esengine::ecs::CapsuleCollider::isSensor)
- .field("enabled", &esengine::ecs::CapsuleCollider::enabled)
- .field("categoryBits", &esengine::ecs::CapsuleCollider::categoryBits)
- .field("maskBits", &esengine::ecs::CapsuleCollider::maskBits);
+ value_object<esengine::ecs::CapsuleCollider2D>("CapsuleCollider2D")
+ .field("radius", &esengine::ecs::CapsuleCollider2D::radius)
+ .field("halfHeight", &esengine::ecs::CapsuleCollider2D::halfHeight)
+ .field("offset", &esengine::ecs::CapsuleCollider2D::offset)
+ .field("density", &esengine::ecs::CapsuleCollider2D::density)
+ .field("friction", &esengine::ecs::CapsuleCollider2D::friction)
+ .field("restitution", &esengine::ecs::CapsuleCollider2D::restitution)
+ .field("isSensor", &esengine::ecs::CapsuleCollider2D::isSensor)
+ .field("enabled", &esengine::ecs::CapsuleCollider2D::enabled)
+ .field("categoryBits", &esengine::ecs::CapsuleCollider2D::categoryBits)
+ .field("maskBits", &esengine::ecs::CapsuleCollider2D::maskBits);
value_object<esengine::ecs::CapsuleCollider3D>("CapsuleCollider3D")
.field("radius", &esengine::ecs::CapsuleCollider3D::radius)
@@ -1388,16 +1388,16 @@ EMSCRIPTEN_BINDINGS(esengine_components) {
value_object<ChildrenJS>("Children")
.field("entities", &ChildrenJS::entities);
- value_object<esengine::ecs::CircleCollider>("CircleCollider")
- .field("radius", &esengine::ecs::CircleCollider::radius)
- .field("offset", &esengine::ecs::CircleCollider::offset)
- .field("density", &esengine::ecs::CircleCollider::density)
- .field("friction", &esengine::ecs::CircleCollider::friction)
- .field("restitution", &esengine::ecs::CircleCollider::restitution)
- .field("isSensor", &esengine::ecs::CircleCollider::isSensor)
- .field("enabled", &esengine::ecs::CircleCollider::enabled)
- .field("categoryBits", &esengine::ecs::CircleCollider::categoryBits)
- .field("maskBits", &esengine::ecs::CircleCollider::maskBits);
+ value_object<esengine::ecs::CircleCollider2D>("CircleCollider2D")
+ .field("radius", &esengine::ecs::CircleCollider2D::radius)
+ .field("offset", &esengine::ecs::CircleCollider2D::offset)
+ .field("density", &esengine::ecs::CircleCollider2D::density)
+ .field("friction", &esengine::ecs::CircleCollider2D::friction)
+ .field("restitution", &esengine::ecs::CircleCollider2D::restitution)
+ .field("isSensor", &esengine::ecs::CircleCollider2D::isSensor)
+ .field("enabled", &esengine::ecs::CircleCollider2D::enabled)
+ .field("categoryBits", &esengine::ecs::CircleCollider2D::categoryBits)
+ .field("maskBits", &esengine::ecs::CircleCollider2D::maskBits);
value_object<ConvexCollider3DJS>("ConvexCollider3D")
.field("mesh", &ConvexCollider3DJS::mesh)
@@ -1557,14 +1557,14 @@ EMSCRIPTEN_BINDINGS(esengine_components) {
.field("falloff", &esengine::ecs::ParticleForceField::falloff)
.field("enabled", &esengine::ecs::ParticleForceField::enabled);
- value_object<RigidBodyJS>("RigidBody")
- .field("bodyType", &RigidBodyJS::bodyType)
- .field("gravityScale", &RigidBodyJS::gravityScale)
- .field("linearDamping", &RigidBodyJS::linearDamping)
- .field("angularDamping", &RigidBodyJS::angularDamping)
- .field("fixedRotation", &RigidBodyJS::fixedRotation)
- .field("bullet", &RigidBodyJS::bullet)
- .field("enabled", &RigidBodyJS::enabled);
+ value_object<RigidBody2DJS>("RigidBody2D")
+ .field("bodyType", &RigidBody2DJS::bodyType)
+ .field("gravityScale", &RigidBody2DJS::gravityScale)
+ .field("linearDamping", &RigidBody2DJS::linearDamping)
+ .field("angularDamping", &RigidBody2DJS::angularDamping)
+ .field("fixedRotation", &RigidBody2DJS::fixedRotation)
+ .field("bullet", &RigidBody2DJS::bullet)
+ .field("enabled", &RigidBody2DJS::enabled);
value_object<RigidBody3DJS>("RigidBody3D")
.field("bodyType", &RigidBody3DJS::bodyType)
@@ -1576,16 +1576,16 @@ EMSCRIPTEN_BINDINGS(esengine_components) {
.field("continuousCollision", &RigidBody3DJS::continuousCollision)
.field("enabled", &RigidBody3DJS::enabled);
- value_object<esengine::ecs::SegmentCollider>("SegmentCollider")
- .field("point1", &esengine::ecs::SegmentCollider::point1)
- .field("point2", &esengine::ecs::SegmentCollider::point2)
- .field("density", &esengine::ecs::SegmentCollider::density)
- .field("friction", &esengine::ecs::SegmentCollider::friction)
- .field("restitution", &esengine::ecs::SegmentCollider::restitution)
- .field("isSensor", &esengine::ecs::SegmentCollider::isSensor)
- .field("enabled", &esengine::ecs::SegmentCollider::enabled)
- .field("categoryBits", &esengine::ecs::SegmentCollider::categoryBits)
- .field("maskBits", &esengine::ecs::SegmentCollider::maskBits);
+ value_object<esengine::ecs::SegmentCollider2D>("SegmentCollider2D")
+ .field("point1", &esengine::ecs::SegmentCollider2D::point1)
+ .field("point2", &esengine::ecs::SegmentCollider2D::point2)
+ .field("density", &esengine::ecs::SegmentCollider2D::density)
+ .field("friction", &esengine::ecs::SegmentCollider2D::friction)
+ .field("restitution", &esengine::ecs::SegmentCollider2D::restitution)
+ .field("isSensor", &esengine::ecs::SegmentCollider2D::isSensor)
+ .field("enabled", &esengine::ecs::SegmentCollider2D::enabled)
+ .field("categoryBits", &esengine::ecs::SegmentCollider2D::categoryBits)
+ .field("maskBits", &esengine::ecs::SegmentCollider2D::maskBits);
value_object<esengine::ecs::ShadowCaster2D>("ShadowCaster2D")
.field("size", &esengine::ecs::ShadowCaster2D::size)
@@ -1785,25 +1785,25 @@ EMSCRIPTEN_BINDINGS(esengine_registry) {
r.remove<esengine::ecs::BitmapText>(entity);
}))
- // BoxCollider
- .function("hasBoxCollider", optional_override([](Registry& r, u32 e) {
- return r.has<esengine::ecs::BoxCollider>(static_cast<Entity>(e));
+ // BoxCollider2D
+ .function("hasBoxCollider2D", optional_override([](Registry& r, u32 e) {
+ return r.has<esengine::ecs::BoxCollider2D>(static_cast<Entity>(e));
}))
- .function("getBoxCollider", optional_override([](Registry& r, u32 e) -> esengine::ecs::BoxCollider& {
+ .function("getBoxCollider2D", optional_override([](Registry& r, u32 e) -> esengine::ecs::BoxCollider2D& {
auto entity = static_cast<Entity>(e);
- static esengine::ecs::BoxCollider s_dummy{};
- if (!r.valid(entity) || !r.has<esengine::ecs::BoxCollider>(entity)) return s_dummy;
- return r.get<esengine::ecs::BoxCollider>(entity);
+ static esengine::ecs::BoxCollider2D s_dummy{};
+ if (!r.valid(entity) || !r.has<esengine::ecs::BoxCollider2D>(entity)) return s_dummy;
+ return r.get<esengine::ecs::BoxCollider2D>(entity);
}), allow_raw_pointers())
- .function("addBoxCollider", optional_override([](Registry& r, u32 e, const esengine::ecs::BoxCollider& c) {
+ .function("addBoxCollider2D", optional_override([](Registry& r, u32 e, const esengine::ecs::BoxCollider2D& c) {
auto entity = static_cast<Entity>(e);
if (!r.valid(entity)) return;
- r.emplaceOrReplace<esengine::ecs::BoxCollider>(entity, c);
+ r.emplaceOrReplace<esengine::ecs::BoxCollider2D>(entity, c);
}))
- .function("removeBoxCollider", optional_override([](Registry& r, u32 e) {
+ .function("removeBoxCollider2D", optional_override([](Registry& r, u32 e) {
auto entity = static_cast<Entity>(e);
- if (!r.valid(entity) || !r.has<esengine::ecs::BoxCollider>(entity)) return;
- r.remove<esengine::ecs::BoxCollider>(entity);
+ if (!r.valid(entity) || !r.has<esengine::ecs::BoxCollider2D>(entity)) return;
+ r.remove<esengine::ecs::BoxCollider2D>(entity);
}))
// BoxCollider3D
@@ -1875,25 +1875,25 @@ EMSCRIPTEN_BINDINGS(esengine_registry) {
r.remove<esengine::ecs::Canvas>(entity);
}))
- // CapsuleCollider
- .function("hasCapsuleCollider", optional_override([](Registry& r, u32 e) {
- return r.has<esengine::ecs::CapsuleCollider>(static_cast<Entity>(e));
+ // CapsuleCollider2D
+ .function("hasCapsuleCollider2D", optional_override([](Registry& r, u32 e) {
+ return r.has<esengine::ecs::CapsuleCollider2D>(static_cast<Entity>(e));
}))
- .function("getCapsuleCollider", optional_override([](Registry& r, u32 e) -> esengine::ecs::CapsuleCollider& {
+ .function("getCapsuleCollider2D", optional_override([](Registry& r, u32 e) -> esengine::ecs::CapsuleCollider2D& {
auto entity = static_cast<Entity>(e);
- static esengine::ecs::CapsuleCollider s_dummy{};
- if (!r.valid(entity) || !r.has<esengine::ecs::CapsuleCollider>(entity)) return s_dummy;
- return r.get<esengine::ecs::CapsuleCollider>(entity);
+ static esengine::ecs::CapsuleCollider2D s_dummy{};
+ if (!r.valid(entity) || !r.has<esengine::ecs::CapsuleCollider2D>(entity)) return s_dummy;
+ return r.get<esengine::ecs::CapsuleCollider2D>(entity);
}), allow_raw_pointers())
- .function("addCapsuleCollider", optional_override([](Registry& r, u32 e, const esengine::ecs::CapsuleCollider& c) {
+ .function("addCapsuleCollider2D", optional_override([](Registry& r, u32 e, const esengine::ecs::CapsuleCollider2D& c) {
auto entity = static_cast<Entity>(e);
if (!r.valid(entity)) return;
- r.emplaceOrReplace<esengine::ecs::CapsuleCollider>(entity, c);
+ r.emplaceOrReplace<esengine::ecs::CapsuleCollider2D>(entity, c);
}))
- .function("removeCapsuleCollider", optional_override([](Registry& r, u32 e) {
+ .function("removeCapsuleCollider2D", optional_override([](Registry& r, u32 e) {
auto entity = static_cast<Entity>(e);
- if (!r.valid(entity) || !r.has<esengine::ecs::CapsuleCollider>(entity)) return;
- r.remove<esengine::ecs::CapsuleCollider>(entity);
+ if (!r.valid(entity) || !r.has<esengine::ecs::CapsuleCollider2D>(entity)) return;
+ r.remove<esengine::ecs::CapsuleCollider2D>(entity);
}))
// CapsuleCollider3D
@@ -1963,25 +1963,25 @@ EMSCRIPTEN_BINDINGS(esengine_registry) {
}
}))
- // CircleCollider
- .function("hasCircleCollider", optional_override([](Registry& r, u32 e) {
- return r.has<esengine::ecs::CircleCollider>(static_cast<Entity>(e));
+ // CircleCollider2D
+ .function("hasCircleCollider2D", optional_override([](Registry& r, u32 e) {
+ return r.has<esengine::ecs::CircleCollider2D>(static_cast<Entity>(e));
}))
- .function("getCircleCollider", optional_override([](Registry& r, u32 e) -> esengine::ecs::CircleCollider& {
+ .function("getCircleCollider2D", optional_override([](Registry& r, u32 e) -> esengine::ecs::CircleCollider2D& {
auto entity = static_cast<Entity>(e);
- static esengine::ecs::CircleCollider s_dummy{};
- if (!r.valid(entity) || !r.has<esengine::ecs::CircleCollider>(entity)) return s_dummy;
- return r.get<esengine::ecs::CircleCollider>(entity);
+ static esengine::ecs::CircleCollider2D s_dummy{};
+ if (!r.valid(entity) || !r.has<esengine::ecs::CircleCollider2D>(entity)) return s_dummy;
+ return r.get<esengine::ecs::CircleCollider2D>(entity);
}), allow_raw_pointers())
- .function("addCircleCollider", optional_override([](Registry& r, u32 e, const esengine::ecs::CircleCollider& c) {
+ .function("addCircleCollider2D", optional_override([](Registry& r, u32 e, const esengine::ecs::CircleCollider2D& c) {
auto entity = static_cast<Entity>(e);
if (!r.valid(entity)) return;
- r.emplaceOrReplace<esengine::ecs::CircleCollider>(entity, c);
+ r.emplaceOrReplace<esengine::ecs::CircleCollider2D>(entity, c);
}))
- .function("removeCircleCollider", optional_override([](Registry& r, u32 e) {
+ .function("removeCircleCollider2D", optional_override([](Registry& r, u32 e) {
auto entity = static_cast<Entity>(e);
- if (!r.valid(entity) || !r.has<esengine::ecs::CircleCollider>(entity)) return;
- r.remove<esengine::ecs::CircleCollider>(entity);
+ if (!r.valid(entity) || !r.has<esengine::ecs::CircleCollider2D>(entity)) return;
+ r.remove<esengine::ecs::CircleCollider2D>(entity);
}))
// ConvexCollider3D
@@ -2256,28 +2256,28 @@ EMSCRIPTEN_BINDINGS(esengine_registry) {
r.remove<esengine::ecs::ParticleForceField>(entity);
}))
- // RigidBody
- .function("hasRigidBody", optional_override([](Registry& r, u32 e) {
- return r.has<esengine::ecs::RigidBody>(static_cast<Entity>(e));
+ // RigidBody2D
+ .function("hasRigidBody2D", optional_override([](Registry& r, u32 e) {
+ return r.has<esengine::ecs::RigidBody2D>(static_cast<Entity>(e));
}))
- .function("getRigidBody", optional_override([](Registry& r, u32 e) {
+ .function("getRigidBody2D", optional_override([](Registry& r, u32 e) {
auto entity = static_cast<Entity>(e);
- if (!r.valid(entity) || !r.has<esengine::ecs::RigidBody>(entity)) return RigidBodyJS{};
- return rigidbodyToJS(r.get<esengine::ecs::RigidBody>(entity));
+ if (!r.valid(entity) || !r.has<esengine::ecs::RigidBody2D>(entity)) return RigidBody2DJS{};
+ return rigidbody2dToJS(r.get<esengine::ecs::RigidBody2D>(entity));
}))
- .function("addRigidBody", optional_override([](Registry& r, u32 e, const RigidBodyJS& js) {
+ .function("addRigidBody2D", optional_override([](Registry& r, u32 e, const RigidBody2DJS& js) {
auto entity = static_cast<Entity>(e);
if (!r.valid(entity)) return;
- if (auto* existing = r.tryGet<esengine::ecs::RigidBody>(entity)) {
- rigidbodyApplyJS(*existing, js);
+ if (auto* existing = r.tryGet<esengine::ecs::RigidBody2D>(entity)) {
+ rigidbody2dApplyJS(*existing, js);
return;
}
- r.emplaceOrReplace<esengine::ecs::RigidBody>(entity, rigidbodyFromJS(js));
+ r.emplaceOrReplace<esengine::ecs::RigidBody2D>(entity, rigidbody2dFromJS(js));
}))
- .function("removeRigidBody", optional_override([](Registry& r, u32 e) {
+ .function("removeRigidBody2D", optional_override([](Registry& r, u32 e) {
auto entity = static_cast<Entity>(e);
- if (!r.valid(entity) || !r.has<esengine::ecs::RigidBody>(entity)) return;
- r.remove<esengine::ecs::RigidBody>(entity);
+ if (!r.valid(entity) || !r.has<esengine::ecs::RigidBody2D>(entity)) return;
+ r.remove<esengine::ecs::RigidBody2D>(entity);
}))
// RigidBody3D
@@ -2304,25 +2304,25 @@ EMSCRIPTEN_BINDINGS(esengine_registry) {
r.remove<esengine::ecs::RigidBody3D>(entity);
}))
- // SegmentCollider
- .function("hasSegmentCollider", optional_override([](Registry& r, u32 e) {
- return r.has<esengine::ecs::SegmentCollider>(static_cast<Entity>(e));
+ // SegmentCollider2D
+ .function("hasSegmentCollider2D", optional_override([](Registry& r, u32 e) {
+ return r.has<esengine::ecs::SegmentCollider2D>(static_cast<Entity>(e));
}))
- .function("getSegmentCollider", optional_override([](Registry& r, u32 e) -> esengine::ecs::SegmentCollider& {
+ .function("getSegmentCollider2D", optional_override([](Registry& r, u32 e) -> esengine::ecs::SegmentCollider2D& {
auto entity = static_cast<Entity>(e);
- static esengine::ecs::SegmentCollider s_dummy{};
- if (!r.valid(entity) || !r.has<esengine::ecs::SegmentCollider>(entity)) return s_dummy;
- return r.get<esengine::ecs::SegmentCollider>(entity);
+ static esengine::ecs::SegmentCollider2D s_dummy{};
+ if (!r.valid(entity) || !r.has<esengine::ecs::SegmentCollider2D>(entity)) return s_dummy;
+ return r.get<esengine::ecs::SegmentCollider2D>(entity);
}), allow_raw_pointers())
- .function("addSegmentCollider", optional_override([](Registry& r, u32 e, const esengine::ecs::SegmentCollider& c) {
+ .function("addSegmentCollider2D", optional_override([](Registry& r, u32 e, const esengine::ecs::SegmentCollider2D& c) {
auto entity = static_cast<Entity>(e);
if (!r.valid(entity)) return;
- r.emplaceOrReplace<esengine::ecs::SegmentCollider>(entity, c);
+ r.emplaceOrReplace<esengine::ecs::SegmentCollider2D>(entity, c);
}))
- .function("removeSegmentCollider", optional_override([](Registry& r, u32 e) {
+ .function("removeSegmentCollider2D", optional_override([](Registry& r, u32 e) {
auto entity = static_cast<Entity>(e);
- if (!r.valid(entity) || !r.has<esengine::ecs::SegmentCollider>(entity)) return;
- r.remove<esengine::ecs::SegmentCollider>(entity);
+ if (!r.valid(entity) || !r.has<esengine::ecs::SegmentCollider2D>(entity)) return;
+ r.remove<esengine::ecs::SegmentCollider2D>(entity);
}))
// ShadowCaster2D
@@ -2659,15 +2659,15 @@ emscripten::val esengineGetBuiltinComponentNames() {
auto arr = val::array();
size_t i = 0;
arr.set(i++, val(std::string("BitmapText")));
- arr.set(i++, val(std::string("BoxCollider")));
+ arr.set(i++, val(std::string("BoxCollider2D")));
arr.set(i++, val(std::string("BoxCollider3D")));
arr.set(i++, val(std::string("Camera")));
arr.set(i++, val(std::string("Canvas")));
- arr.set(i++, val(std::string("CapsuleCollider")));
+ arr.set(i++, val(std::string("CapsuleCollider2D")));
arr.set(i++, val(std::string("CapsuleCollider3D")));
arr.set(i++, val(std::string("CharacterController3D")));
arr.set(i++, val(std::string("Children")));
- arr.set(i++, val(std::string("CircleCollider")));
+ arr.set(i++, val(std::string("CircleCollider2D")));
arr.set(i++, val(std::string("ConvexCollider3D")));
arr.set(i++, val(std::string("Draggable")));
arr.set(i++, val(std::string("DragonBonesAnimation")));
@@ -2680,9 +2680,9 @@ emscripten::val esengineGetBuiltinComponentNames() {
arr.set(i++, val(std::string("Parent")));
arr.set(i++, val(std::string("ParticleEmitter")));
arr.set(i++, val(std::string("ParticleForceField")));
- arr.set(i++, val(std::string("RigidBody")));
+ arr.set(i++, val(std::string("RigidBody2D")));
arr.set(i++, val(std::string("RigidBody3D")));
- arr.set(i++, val(std::string("SegmentCollider")));
+ arr.set(i++, val(std::string("SegmentCollider2D")));
arr.set(i++, val(std::string("ShadowCaster2D")));
arr.set(i++, val(std::string("ShapeRenderer")));
arr.set(i++, val(std::string("SphereCollider3D")));
@@ -2719,15 +2719,15 @@ static_assert(offsetof(esengine::ecs::BitmapText, parallax) == 40, "ABI offset d
static_assert(offsetof(esengine::ecs::BitmapText, layer) == 48, "ABI offset drift: esengine::ecs::BitmapText.layer (EHT expected 48)");
static_assert(offsetof(esengine::ecs::BitmapText, font) == 52, "ABI offset drift: esengine::ecs::BitmapText.font (EHT expected 52)");
static_assert(offsetof(esengine::ecs::BitmapText, enabled) == 56, "ABI offset drift: esengine::ecs::BitmapText.enabled (EHT expected 56)");
-static_assert(offsetof(esengine::ecs::BoxCollider, halfExtents) == 0, "ABI offset drift: esengine::ecs::BoxCollider.halfExtents (EHT expected 0)");
-static_assert(offsetof(esengine::ecs::BoxCollider, offset) == 8, "ABI offset drift: esengine::ecs::BoxCollider.offset (EHT expected 8)");
-static_assert(offsetof(esengine::ecs::BoxCollider, density) == 16, "ABI offset drift: esengine::ecs::BoxCollider.density (EHT expected 16)");
-static_assert(offsetof(esengine::ecs::BoxCollider, friction) == 20, "ABI offset drift: esengine::ecs::BoxCollider.friction (EHT expected 20)");
-static_assert(offsetof(esengine::ecs::BoxCollider, restitution) == 24, "ABI offset drift: esengine::ecs::BoxCollider.restitution (EHT expected 24)");
-static_assert(offsetof(esengine::ecs::BoxCollider, isSensor) == 28, "ABI offset drift: esengine::ecs::BoxCollider.isSensor (EHT expected 28)");
-static_assert(offsetof(esengine::ecs::BoxCollider, enabled) == 29, "ABI offset drift: esengine::ecs::BoxCollider.enabled (EHT expected 29)");
-static_assert(offsetof(esengine::ecs::BoxCollider, categoryBits) == 32, "ABI offset drift: esengine::ecs::BoxCollider.categoryBits (EHT expected 32)");
-static_assert(offsetof(esengine::ecs::BoxCollider, maskBits) == 36, "ABI offset drift: esengine::ecs::BoxCollider.maskBits (EHT expected 36)");
+static_assert(offsetof(esengine::ecs::BoxCollider2D, halfExtents) == 0, "ABI offset drift: esengine::ecs::BoxCollider2D.halfExtents (EHT expected 0)");
+static_assert(offsetof(esengine::ecs::BoxCollider2D, offset) == 8, "ABI offset drift: esengine::ecs::BoxCollider2D.offset (EHT expected 8)");
+static_assert(offsetof(esengine::ecs::BoxCollider2D, density) == 16, "ABI offset drift: esengine::ecs::BoxCollider2D.density (EHT expected 16)");
+static_assert(offsetof(esengine::ecs::BoxCollider2D, friction) == 20, "ABI offset drift: esengine::ecs::BoxCollider2D.friction (EHT expected 20)");
+static_assert(offsetof(esengine::ecs::BoxCollider2D, restitution) == 24, "ABI offset drift: esengine::ecs::BoxCollider2D.restitution (EHT expected 24)");
+static_assert(offsetof(esengine::ecs::BoxCollider2D, isSensor) == 28, "ABI offset drift: esengine::ecs::BoxCollider2D.isSensor (EHT expected 28)");
+static_assert(offsetof(esengine::ecs::BoxCollider2D, enabled) == 29, "ABI offset drift: esengine::ecs::BoxCollider2D.enabled (EHT expected 29)");
+static_assert(offsetof(esengine::ecs::BoxCollider2D, categoryBits) == 32, "ABI offset drift: esengine::ecs::BoxCollider2D.categoryBits (EHT expected 32)");
+static_assert(offsetof(esengine::ecs::BoxCollider2D, maskBits) == 36, "ABI offset drift: esengine::ecs::BoxCollider2D.maskBits (EHT expected 36)");
static_assert(offsetof(esengine::ecs::BoxCollider3D, halfExtents) == 0, "ABI offset drift: esengine::ecs::BoxCollider3D.halfExtents (EHT expected 0)");
static_assert(offsetof(esengine::ecs::BoxCollider3D, friction) == 12, "ABI offset drift: esengine::ecs::BoxCollider3D.friction (EHT expected 12)");
static_assert(offsetof(esengine::ecs::BoxCollider3D, restitution) == 16, "ABI offset drift: esengine::ecs::BoxCollider3D.restitution (EHT expected 16)");
@@ -2752,16 +2752,16 @@ static_assert(offsetof(esengine::ecs::Canvas, scaleMode) == 12, "ABI offset drif
static_assert(offsetof(esengine::ecs::Canvas, matchWidthOrHeight) == 16, "ABI offset drift: esengine::ecs::Canvas.matchWidthOrHeight (EHT expected 16)");
static_assert(offsetof(esengine::ecs::Canvas, backgroundColor) == 20, "ABI offset drift: esengine::ecs::Canvas.backgroundColor (EHT expected 20)");
static_assert(offsetof(esengine::ecs::Canvas, layer) == 36, "ABI offset drift: esengine::ecs::Canvas.layer (EHT expected 36)");
-static_assert(offsetof(esengine::ecs::CapsuleCollider, radius) == 0, "ABI offset drift: esengine::ecs::CapsuleCollider.radius (EHT expected 0)");
-static_assert(offsetof(esengine::ecs::CapsuleCollider, halfHeight) == 4, "ABI offset drift: esengine::ecs::CapsuleCollider.halfHeight (EHT expected 4)");
-static_assert(offsetof(esengine::ecs::CapsuleCollider, offset) == 8, "ABI offset drift: esengine::ecs::CapsuleCollider.offset (EHT expected 8)");
-static_assert(offsetof(esengine::ecs::CapsuleCollider, density) == 16, "ABI offset drift: esengine::ecs::CapsuleCollider.density (EHT expected 16)");
-static_assert(offsetof(esengine::ecs::CapsuleCollider, friction) == 20, "ABI offset drift: esengine::ecs::CapsuleCollider.friction (EHT expected 20)");
-static_assert(offsetof(esengine::ecs::CapsuleCollider, restitution) == 24, "ABI offset drift: esengine::ecs::CapsuleCollider.restitution (EHT expected 24)");
-static_assert(offsetof(esengine::ecs::CapsuleCollider, isSensor) == 28, "ABI offset drift: esengine::ecs::CapsuleCollider.isSensor (EHT expected 28)");
-static_assert(offsetof(esengine::ecs::CapsuleCollider, enabled) == 29, "ABI offset drift: esengine::ecs::CapsuleCollider.enabled (EHT expected 29)");
-static_assert(offsetof(esengine::ecs::CapsuleCollider, categoryBits) == 32, "ABI offset drift: esengine::ecs::CapsuleCollider.categoryBits (EHT expected 32)");
-static_assert(offsetof(esengine::ecs::CapsuleCollider, maskBits) == 36, "ABI offset drift: esengine::ecs::CapsuleCollider.maskBits (EHT expected 36)");
+static_assert(offsetof(esengine::ecs::CapsuleCollider2D, radius) == 0, "ABI offset drift: esengine::ecs::CapsuleCollider2D.radius (EHT expected 0)");
+static_assert(offsetof(esengine::ecs::CapsuleCollider2D, halfHeight) == 4, "ABI offset drift: esengine::ecs::CapsuleCollider2D.halfHeight (EHT expected 4)");
+static_assert(offsetof(esengine::ecs::CapsuleCollider2D, offset) == 8, "ABI offset drift: esengine::ecs::CapsuleCollider2D.offset (EHT expected 8)");
+static_assert(offsetof(esengine::ecs::CapsuleCollider2D, density) == 16, "ABI offset drift: esengine::ecs::CapsuleCollider2D.density (EHT expected 16)");
+static_assert(offsetof(esengine::ecs::CapsuleCollider2D, friction) == 20, "ABI offset drift: esengine::ecs::CapsuleCollider2D.friction (EHT expected 20)");
+static_assert(offsetof(esengine::ecs::CapsuleCollider2D, restitution) == 24, "ABI offset drift: esengine::ecs::CapsuleCollider2D.restitution (EHT expected 24)");
+static_assert(offsetof(esengine::ecs::CapsuleCollider2D, isSensor) == 28, "ABI offset drift: esengine::ecs::CapsuleCollider2D.isSensor (EHT expected 28)");
+static_assert(offsetof(esengine::ecs::CapsuleCollider2D, enabled) == 29, "ABI offset drift: esengine::ecs::CapsuleCollider2D.enabled (EHT expected 29)");
+static_assert(offsetof(esengine::ecs::CapsuleCollider2D, categoryBits) == 32, "ABI offset drift: esengine::ecs::CapsuleCollider2D.categoryBits (EHT expected 32)");
+static_assert(offsetof(esengine::ecs::CapsuleCollider2D, maskBits) == 36, "ABI offset drift: esengine::ecs::CapsuleCollider2D.maskBits (EHT expected 36)");
static_assert(offsetof(esengine::ecs::CapsuleCollider3D, radius) == 0, "ABI offset drift: esengine::ecs::CapsuleCollider3D.radius (EHT expected 0)");
static_assert(offsetof(esengine::ecs::CapsuleCollider3D, halfHeight) == 4, "ABI offset drift: esengine::ecs::CapsuleCollider3D.halfHeight (EHT expected 4)");
static_assert(offsetof(esengine::ecs::CapsuleCollider3D, friction) == 8, "ABI offset drift: esengine::ecs::CapsuleCollider3D.friction (EHT expected 8)");
@@ -2781,15 +2781,15 @@ static_assert(offsetof(esengine::ecs::CharacterController3D, layer) == 44, "ABI
static_assert(offsetof(esengine::ecs::CharacterController3D, isOnFloor) == 48, "ABI offset drift: esengine::ecs::CharacterController3D.isOnFloor (EHT expected 48)");
static_assert(offsetof(esengine::ecs::CharacterController3D, floorNormal) == 52, "ABI offset drift: esengine::ecs::CharacterController3D.floorNormal (EHT expected 52)");
static_assert(offsetof(esengine::ecs::CharacterController3D, realVelocity) == 64, "ABI offset drift: esengine::ecs::CharacterController3D.realVelocity (EHT expected 64)");
-static_assert(offsetof(esengine::ecs::CircleCollider, radius) == 0, "ABI offset drift: esengine::ecs::CircleCollider.radius (EHT expected 0)");
-static_assert(offsetof(esengine::ecs::CircleCollider, offset) == 4, "ABI offset drift: esengine::ecs::CircleCollider.offset (EHT expected 4)");
-static_assert(offsetof(esengine::ecs::CircleCollider, density) == 12, "ABI offset drift: esengine::ecs::CircleCollider.density (EHT expected 12)");
-static_assert(offsetof(esengine::ecs::CircleCollider, friction) == 16, "ABI offset drift: esengine::ecs::CircleCollider.friction (EHT expected 16)");
-static_assert(offsetof(esengine::ecs::CircleCollider, restitution) == 20, "ABI offset drift: esengine::ecs::CircleCollider.restitution (EHT expected 20)");
-static_assert(offsetof(esengine::ecs::CircleCollider, isSensor) == 24, "ABI offset drift: esengine::ecs::CircleCollider.isSensor (EHT expected 24)");
-static_assert(offsetof(esengine::ecs::CircleCollider, enabled) == 25, "ABI offset drift: esengine::ecs::CircleCollider.enabled (EHT expected 25)");
-static_assert(offsetof(esengine::ecs::CircleCollider, categoryBits) == 28, "ABI offset drift: esengine::ecs::CircleCollider.categoryBits (EHT expected 28)");
-static_assert(offsetof(esengine::ecs::CircleCollider, maskBits) == 32, "ABI offset drift: esengine::ecs::CircleCollider.maskBits (EHT expected 32)");
+static_assert(offsetof(esengine::ecs::CircleCollider2D, radius) == 0, "ABI offset drift: esengine::ecs::CircleCollider2D.radius (EHT expected 0)");
+static_assert(offsetof(esengine::ecs::CircleCollider2D, offset) == 4, "ABI offset drift: esengine::ecs::CircleCollider2D.offset (EHT expected 4)");
+static_assert(offsetof(esengine::ecs::CircleCollider2D, density) == 12, "ABI offset drift: esengine::ecs::CircleCollider2D.density (EHT expected 12)");
+static_assert(offsetof(esengine::ecs::CircleCollider2D, friction) == 16, "ABI offset drift: esengine::ecs::CircleCollider2D.friction (EHT expected 16)");
+static_assert(offsetof(esengine::ecs::CircleCollider2D, restitution) == 20, "ABI offset drift: esengine::ecs::CircleCollider2D.restitution (EHT expected 20)");
+static_assert(offsetof(esengine::ecs::CircleCollider2D, isSensor) == 24, "ABI offset drift: esengine::ecs::CircleCollider2D.isSensor (EHT expected 24)");
+static_assert(offsetof(esengine::ecs::CircleCollider2D, enabled) == 25, "ABI offset drift: esengine::ecs::CircleCollider2D.enabled (EHT expected 25)");
+static_assert(offsetof(esengine::ecs::CircleCollider2D, categoryBits) == 28, "ABI offset drift: esengine::ecs::CircleCollider2D.categoryBits (EHT expected 28)");
+static_assert(offsetof(esengine::ecs::CircleCollider2D, maskBits) == 32, "ABI offset drift: esengine::ecs::CircleCollider2D.maskBits (EHT expected 32)");
static_assert(offsetof(esengine::ecs::ConvexCollider3D, mesh) == 0, "ABI offset drift: esengine::ecs::ConvexCollider3D.mesh (EHT expected 0)");
static_assert(offsetof(esengine::ecs::ConvexCollider3D, friction) == 4, "ABI offset drift: esengine::ecs::ConvexCollider3D.friction (EHT expected 4)");
static_assert(offsetof(esengine::ecs::ConvexCollider3D, restitution) == 8, "ABI offset drift: esengine::ecs::ConvexCollider3D.restitution (EHT expected 8)");
@@ -2918,13 +2918,13 @@ static_assert(offsetof(esengine::ecs::ParticleForceField, radius) == 8, "ABI off
static_assert(offsetof(esengine::ecs::ParticleForceField, direction) == 12, "ABI offset drift: esengine::ecs::ParticleForceField.direction (EHT expected 12)");
static_assert(offsetof(esengine::ecs::ParticleForceField, falloff) == 24, "ABI offset drift: esengine::ecs::ParticleForceField.falloff (EHT expected 24)");
static_assert(offsetof(esengine::ecs::ParticleForceField, enabled) == 25, "ABI offset drift: esengine::ecs::ParticleForceField.enabled (EHT expected 25)");
-static_assert(offsetof(esengine::ecs::RigidBody, bodyType) == 0, "ABI offset drift: esengine::ecs::RigidBody.bodyType (EHT expected 0)");
-static_assert(offsetof(esengine::ecs::RigidBody, gravityScale) == 4, "ABI offset drift: esengine::ecs::RigidBody.gravityScale (EHT expected 4)");
-static_assert(offsetof(esengine::ecs::RigidBody, linearDamping) == 8, "ABI offset drift: esengine::ecs::RigidBody.linearDamping (EHT expected 8)");
-static_assert(offsetof(esengine::ecs::RigidBody, angularDamping) == 12, "ABI offset drift: esengine::ecs::RigidBody.angularDamping (EHT expected 12)");
-static_assert(offsetof(esengine::ecs::RigidBody, fixedRotation) == 16, "ABI offset drift: esengine::ecs::RigidBody.fixedRotation (EHT expected 16)");
-static_assert(offsetof(esengine::ecs::RigidBody, bullet) == 17, "ABI offset drift: esengine::ecs::RigidBody.bullet (EHT expected 17)");
-static_assert(offsetof(esengine::ecs::RigidBody, enabled) == 18, "ABI offset drift: esengine::ecs::RigidBody.enabled (EHT expected 18)");
+static_assert(offsetof(esengine::ecs::RigidBody2D, bodyType) == 0, "ABI offset drift: esengine::ecs::RigidBody2D.bodyType (EHT expected 0)");
+static_assert(offsetof(esengine::ecs::RigidBody2D, gravityScale) == 4, "ABI offset drift: esengine::ecs::RigidBody2D.gravityScale (EHT expected 4)");
+static_assert(offsetof(esengine::ecs::RigidBody2D, linearDamping) == 8, "ABI offset drift: esengine::ecs::RigidBody2D.linearDamping (EHT expected 8)");
+static_assert(offsetof(esengine::ecs::RigidBody2D, angularDamping) == 12, "ABI offset drift: esengine::ecs::RigidBody2D.angularDamping (EHT expected 12)");
+static_assert(offsetof(esengine::ecs::RigidBody2D, fixedRotation) == 16, "ABI offset drift: esengine::ecs::RigidBody2D.fixedRotation (EHT expected 16)");
+static_assert(offsetof(esengine::ecs::RigidBody2D, bullet) == 17, "ABI offset drift: esengine::ecs::RigidBody2D.bullet (EHT expected 17)");
+static_assert(offsetof(esengine::ecs::RigidBody2D, enabled) == 18, "ABI offset drift: esengine::ecs::RigidBody2D.enabled (EHT expected 18)");
static_assert(offsetof(esengine::ecs::RigidBody3D, bodyType) == 0, "ABI offset drift: esengine::ecs::RigidBody3D.bodyType (EHT expected 0)");
static_assert(offsetof(esengine::ecs::RigidBody3D, gravityScale) == 4, "ABI offset drift: esengine::ecs::RigidBody3D.gravityScale (EHT expected 4)");
static_assert(offsetof(esengine::ecs::RigidBody3D, linearDamping) == 8, "ABI offset drift: esengine::ecs::RigidBody3D.linearDamping (EHT expected 8)");
@@ -2933,15 +2933,15 @@ static_assert(offsetof(esengine::ecs::RigidBody3D, fixedRotation) == 16, "ABI of
static_assert(offsetof(esengine::ecs::RigidBody3D, layer) == 20, "ABI offset drift: esengine::ecs::RigidBody3D.layer (EHT expected 20)");
static_assert(offsetof(esengine::ecs::RigidBody3D, continuousCollision) == 24, "ABI offset drift: esengine::ecs::RigidBody3D.continuousCollision (EHT expected 24)");
static_assert(offsetof(esengine::ecs::RigidBody3D, enabled) == 25, "ABI offset drift: esengine::ecs::RigidBody3D.enabled (EHT expected 25)");
-static_assert(offsetof(esengine::ecs::SegmentCollider, point1) == 0, "ABI offset drift: esengine::ecs::SegmentCollider.point1 (EHT expected 0)");
-static_assert(offsetof(esengine::ecs::SegmentCollider, point2) == 8, "ABI offset drift: esengine::ecs::SegmentCollider.point2 (EHT expected 8)");
-static_assert(offsetof(esengine::ecs::SegmentCollider, density) == 16, "ABI offset drift: esengine::ecs::SegmentCollider.density (EHT expected 16)");
-static_assert(offsetof(esengine::ecs::SegmentCollider, friction) == 20, "ABI offset drift: esengine::ecs::SegmentCollider.friction (EHT expected 20)");
-static_assert(offsetof(esengine::ecs::SegmentCollider, restitution) == 24, "ABI offset drift: esengine::ecs::SegmentCollider.restitution (EHT expected 24)");
-static_assert(offsetof(esengine::ecs::SegmentCollider, isSensor) == 28, "ABI offset drift: esengine::ecs::SegmentCollider.isSensor (EHT expected 28)");
-static_assert(offsetof(esengine::ecs::SegmentCollider, enabled) == 29, "ABI offset drift: esengine::ecs::SegmentCollider.enabled (EHT expected 29)");
-static_assert(offsetof(esengine::ecs::SegmentCollider, categoryBits) == 32, "ABI offset drift: esengine::ecs::SegmentCollider.categoryBits (EHT expected 32)");
-static_assert(offsetof(esengine::ecs::SegmentCollider, maskBits) == 36, "ABI offset drift: esengine::ecs::SegmentCollider.maskBits (EHT expected 36)");
+static_assert(offsetof(esengine::ecs::SegmentCollider2D, point1) == 0, "ABI offset drift: esengine::ecs::SegmentCollider2D.point1 (EHT expected 0)");
+static_assert(offsetof(esengine::ecs::SegmentCollider2D, point2) == 8, "ABI offset drift: esengine::ecs::SegmentCollider2D.point2 (EHT expected 8)");
+static_assert(offsetof(esengine::ecs::SegmentCollider2D, density) == 16, "ABI offset drift: esengine::ecs::SegmentCollider2D.density (EHT expected 16)");
+static_assert(offsetof(esengine::ecs::SegmentCollider2D, friction) == 20, "ABI offset drift: esengine::ecs::SegmentCollider2D.friction (EHT expected 20)");
+static_assert(offsetof(esengine::ecs::SegmentCollider2D, restitution) == 24, "ABI offset drift: esengine::ecs::SegmentCollider2D.restitution (EHT expected 24)");
+static_assert(offsetof(esengine::ecs::SegmentCollider2D, isSensor) == 28, "ABI offset drift: esengine::ecs::SegmentCollider2D.isSensor (EHT expected 28)");
+static_assert(offsetof(esengine::ecs::SegmentCollider2D, enabled) == 29, "ABI offset drift: esengine::ecs::SegmentCollider2D.enabled (EHT expected 29)");
+static_assert(offsetof(esengine::ecs::SegmentCollider2D, categoryBits) == 32, "ABI offset drift: esengine::ecs::SegmentCollider2D.categoryBits (EHT expected 32)");
+static_assert(offsetof(esengine::ecs::SegmentCollider2D, maskBits) == 36, "ABI offset drift: esengine::ecs::SegmentCollider2D.maskBits (EHT expected 36)");
static_assert(offsetof(esengine::ecs::ShadowCaster2D, size) == 0, "ABI offset drift: esengine::ecs::ShadowCaster2D.size (EHT expected 0)");
static_assert(offsetof(esengine::ecs::ShadowCaster2D, enabled) == 8, "ABI offset drift: esengine::ecs::ShadowCaster2D.enabled (EHT expected 8)");
static_assert(offsetof(esengine::ecs::ShapeRenderer, shapeType) == 0, "ABI offset drift: esengine::ecs::ShapeRenderer.shapeType (EHT expected 0)");
@@ -3070,7 +3070,7 @@ static_assert(offsetof(esengine::ecs::Velocity, angular) == 12, "ABI offset drif
// ABI Hash -- runtime handshake against the SDK bundle
// =============================================================================
-static const char* kEsAbiLayoutHash = "f4ba1e6b5d361dee";
+static const char* kEsAbiLayoutHash = "70afde061183c505";
std::string esengineGetAbiLayoutHash() {
return std::string(kEsAbiLayoutHash);
diff --git a/src/esengine/bindings/WebSDKEntry.cpp b/src/esengine/bindings/WebSDKEntry.cpp
index ad4a12922..d801b7e6d 100644
--- a/src/esengine/bindings/WebSDKEntry.cpp
+++ b/src/esengine/bindings/WebSDKEntry.cpp
@@ -56,8 +56,8 @@
#include "../ecs/components/Camera.hpp"
#include "../ecs/components/UINode.hpp"
#include "../ecs/components/UIVisual.hpp"
-#include "../ecs/components/RigidBody.hpp"
-#include "../ecs/components/Collider.hpp"
+#include "../ecs/components/RigidBody2D.hpp"
+#include "../ecs/components/Collider2D.hpp"
#include "../ecs/components/ShapeRenderer.hpp"
#include "../animation/TweenSystem.hpp"
#ifdef ES_ENABLE_PARTICLES
@@ -406,19 +406,19 @@ int getCameraPtr(ecs::Registry& r, u32 e) {
}
int getRigidBodyPtr(ecs::Registry& r, u32 e) {
- auto* rb = r.tryGet<ecs::RigidBody>(Entity::fromRaw(e));
+ auto* rb = r.tryGet<ecs::RigidBody2D>(Entity::fromRaw(e));
if (!rb) return 0;
return static_cast<int>(reinterpret_cast<uintptr_t>(rb));
}
int getBoxColliderPtr(ecs::Registry& r, u32 e) {
- auto* bc = r.tryGet<ecs::BoxCollider>(Entity::fromRaw(e));
+ auto* bc = r.tryGet<ecs::BoxCollider2D>(Entity::fromRaw(e));
if (!bc) return 0;
return static_cast<int>(reinterpret_cast<uintptr_t>(bc));
}
int getCircleColliderPtr(ecs::Registry& r, u32 e) {
- auto* cc = r.tryGet<ecs::CircleCollider>(Entity::fromRaw(e));
+ auto* cc = r.tryGet<ecs::CircleCollider2D>(Entity::fromRaw(e));
if (!cc) return 0;
return static_cast<int>(reinterpret_cast<uintptr_t>(cc));
}
diff --git a/src/esengine/bindings/modules/physics/PhysicsModuleEntry.cpp b/src/esengine/bindings/modules/physics/PhysicsModuleEntry.cpp
index c6497c463..0eca3bf92 100644
--- a/src/esengine/bindings/modules/physics/PhysicsModuleEntry.cpp
+++ b/src/esengine/bindings/modules/physics/PhysicsModuleEntry.cpp
@@ -185,7 +185,7 @@ int physics_hasBody(uint32_t entityId) {
return g_ctx.entityToBody.contains(entityId) ? 1 : 0;
}
-// Enable / disable a body in place (RigidBody.enabled). Unlike destroy, this keeps
+// Enable / disable a body in place (RigidBody2D.enabled). Unlike destroy, this keeps
// the body, its shapes, velocity, and joints — b2Body_Disable just removes it from
// simulation/broadphase — so the reconciler can toggle without losing state.
EMSCRIPTEN_KEEPALIVE
@@ -292,7 +292,7 @@ uintptr_t physics_getDynamicBodyTransforms() {
if (it == g_ctx.entityToBody.end() || !b2Body_IsValid(it->second)) continue;
// A disabled body is frozen; skip it so the readback doesn't stamp its
// stale pose back over a Transform the game is hand-animating while
- // physics is off (RigidBody.enabled = false).
+ // physics is off (RigidBody2D.enabled = false).
if (!b2Body_IsEnabled(it->second)) continue;
b2Vec2 pos = b2Body_GetPosition(it->second);
diff --git a/src/esengine/bindings/modules/physics3d/Physics3DModuleEntry.cpp b/src/esengine/bindings/modules/physics3d/Physics3DModuleEntry.cpp
index de583318f..b6d68a62d 100644
--- a/src/esengine/bindings/modules/physics3d/Physics3DModuleEntry.cpp
+++ b/src/esengine/bindings/modules/physics3d/Physics3DModuleEntry.cpp
@@ -321,7 +321,7 @@ uint32_t physics3d_addSphere(uint32_t entity, float radius,
}
/// `halfHeight` is the cylinder half-height, so the capsule is `2*halfHeight + 2*radius`
-/// tall — the same convention CapsuleCollider uses in 2D.
+/// tall — the same convention CapsuleCollider2D uses in 2D.
EMSCRIPTEN_KEEPALIVE
uint32_t physics3d_addCapsule(uint32_t entity, float radius, float halfHeight,
float px, float py, float pz,
diff --git a/src/esengine/ecs/components/BodyType.hpp b/src/esengine/ecs/components/BodyType.hpp
new file mode 100644
index 000000000..cccfc056a
--- /dev/null
+++ b/src/esengine/ecs/components/BodyType.hpp
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+/**
+ * @file BodyType.hpp
+ * @brief How a solver is allowed to move a body — the one answer both worlds give.
+ * @details It lived in the flat body's header, which meant `RigidBody3D.hpp`
+ * included `RigidBody.hpp` to reach it. Neither plane owns this: a body
+ * is static, kinematic or dynamic in two dimensions and in three, and
+ * the enum crosses the boundary as one set of ordinals.
+ */
+#pragma once
+
+#include "../../core/Types.hpp"
+#include "../../core/Reflection.hpp"
+
+namespace esengine::ecs {
+
+ES_ENUM()
+enum class BodyType : u8 {
+ Static,
+ Kinematic,
+ Dynamic
+};
+
+} // namespace esengine::ecs
diff --git a/src/esengine/ecs/components/Collider.hpp b/src/esengine/ecs/components/Collider2D.hpp
similarity index 78%
rename from src/esengine/ecs/components/Collider.hpp
rename to src/esengine/ecs/components/Collider2D.hpp
index 83c43ce70..ffb5a137f 100644
--- a/src/esengine/ecs/components/Collider.hpp
+++ b/src/esengine/ecs/components/Collider2D.hpp
@@ -1,5 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+/**
+ * @file Collider2D.hpp
+ * @brief The shapes that give a flat body its extent.
+ * @details Suffixed for the plane they are in, beside the `*Collider3D` set in
+ * RigidBody3D.hpp. An unsuffixed name here would read as the default,
+ * and in a world that is three-dimensional it is not the default.
+ */
#pragma once
#include "../../core/Types.hpp"
@@ -9,7 +16,7 @@
namespace esengine::ecs {
ES_COMPONENT()
-struct BoxCollider {
+struct BoxCollider2D {
ES_PROPERTY()
glm::vec2 halfExtents{0.5f, 0.5f};
@@ -37,11 +44,11 @@ struct BoxCollider {
ES_PROPERTY()
u32 maskBits{0xFFFF};
- BoxCollider() = default;
+ BoxCollider2D() = default;
};
ES_COMPONENT()
-struct CircleCollider {
+struct CircleCollider2D {
ES_PROPERTY()
f32 radius{0.5f};
@@ -69,11 +76,11 @@ struct CircleCollider {
ES_PROPERTY()
u32 maskBits{0xFFFF};
- CircleCollider() = default;
+ CircleCollider2D() = default;
};
ES_COMPONENT()
-struct CapsuleCollider {
+struct CapsuleCollider2D {
ES_PROPERTY()
f32 radius{0.25f};
@@ -104,11 +111,11 @@ struct CapsuleCollider {
ES_PROPERTY()
u32 maskBits{0xFFFF};
- CapsuleCollider() = default;
+ CapsuleCollider2D() = default;
};
ES_COMPONENT()
-struct SegmentCollider {
+struct SegmentCollider2D {
ES_PROPERTY()
glm::vec2 point1{-0.5f, 0.0f};
@@ -136,7 +143,7 @@ struct SegmentCollider {
ES_PROPERTY()
u32 maskBits{0xFFFF};
- SegmentCollider() = default;
+ SegmentCollider2D() = default;
};
diff --git a/src/esengine/ecs/components/RigidBody.hpp b/src/esengine/ecs/components/RigidBody2D.hpp
similarity index 61%
rename from src/esengine/ecs/components/RigidBody.hpp
rename to src/esengine/ecs/components/RigidBody2D.hpp
index a85783238..41037c918 100644
--- a/src/esengine/ecs/components/RigidBody.hpp
+++ b/src/esengine/ecs/components/RigidBody2D.hpp
@@ -1,21 +1,22 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+/**
+ * @file RigidBody2D.hpp
+ * @brief A body the flat world simulates.
+ * @details Named for its plane, unlike `Light` or `MeshRenderer`: there really
+ * are two physics worlds, and this is the one Box2D steps. `RigidBody3D`
+ * is the other, and neither is the default.
+ */
#pragma once
#include "../../core/Types.hpp"
#include "../../core/Reflection.hpp"
+#include "./BodyType.hpp"
namespace esengine::ecs {
-ES_ENUM()
-enum class BodyType : u8 {
- Static,
- Kinematic,
- Dynamic
-};
-
ES_COMPONENT()
-struct RigidBody {
+struct RigidBody2D {
ES_PROPERTY()
BodyType bodyType{BodyType::Dynamic};
@@ -37,7 +38,7 @@ struct RigidBody {
ES_PROPERTY()
bool enabled{true};
- RigidBody() = default;
+ RigidBody2D() = default;
};
} // namespace esengine::ecs
diff --git a/src/esengine/ecs/components/RigidBody3D.hpp b/src/esengine/ecs/components/RigidBody3D.hpp
index 9155cf1d9..062af841f 100644
--- a/src/esengine/ecs/components/RigidBody3D.hpp
+++ b/src/esengine/ecs/components/RigidBody3D.hpp
@@ -20,7 +20,7 @@
#include "../../core/Types.hpp"
#include "../../core/Reflection.hpp"
#include "../../math/Math.hpp"
-#include "./RigidBody.hpp"
+#include "./BodyType.hpp"
namespace esengine::ecs {
diff --git a/src/esengine/ecs/components/Velocity.hpp b/src/esengine/ecs/components/Velocity.hpp
index 6bf6012fc..259360b8c 100644
--- a/src/esengine/ecs/components/Velocity.hpp
+++ b/src/esengine/ecs/components/Velocity.hpp
@@ -32,7 +32,7 @@ namespace esengine::ecs {
*
* @details Stores linear and angular velocity. The SDK's VelocitySystem
* integrates it into Transform every Update in play mode; entities
- * owned by the physics solver (RigidBody) are skipped so the two
+ * owned by the physics solver (RigidBody2D) are skipped so the two
* never double-move an entity.
*
* @note Angular velocity is in radians per second around each axis.
diff --git a/templates/2d-platformer/assets/prefabs/Coin.esprefab b/templates/2d-platformer/assets/prefabs/Coin.esprefab
index 41f4104c0..0ad2eae37 100644
--- a/templates/2d-platformer/assets/prefabs/Coin.esprefab
+++ b/templates/2d-platformer/assets/prefabs/Coin.esprefab
@@ -12,8 +12,8 @@
{ "type": "Transform", "data": { "position": { "x": 0, "y": 0, "z": 0 } } },
{ "type": "Sprite", "data": { "size": { "x": 24, "y": 24 }, "color": { "r": 1, "g": 0.85, "b": 0, "a": 1 }, "texture": "@uuid:c18959bd-f6be-49d3-945b-3d6ecf8ef14f" } },
{ "type": "Coin", "data": { "baseY": 0, "bobTimer": 0 } },
- { "type": "RigidBody", "data": { "bodyType": 0 } },
- { "type": "BoxCollider", "data": { "halfExtents": { "x": 0.12, "y": 0.12 }, "isSensor": true, "categoryBits": 2, "maskBits": 65535 } }
+ { "type": "RigidBody2D", "data": { "bodyType": 0 } },
+ { "type": "BoxCollider2D", "data": { "halfExtents": { "x": 0.12, "y": 0.12 }, "isSensor": true, "categoryBits": 2, "maskBits": 65535 } }
],
"visible": true
}
diff --git a/templates/2d-platformer/assets/scenes/main.esscene b/templates/2d-platformer/assets/scenes/main.esscene
index c98b5730f..279ea89af 100644
--- a/templates/2d-platformer/assets/scenes/main.esscene
+++ b/templates/2d-platformer/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"folders": [
"Environment",
@@ -101,13 +101,13 @@
}
},
{
- "type": "RigidBody",
+ "type": "RigidBody2D",
"data": {
"bodyType": 0
}
},
{
- "type": "BoxCollider",
+ "type": "BoxCollider2D",
"data": {
"halfExtents": {
"x": 4,
@@ -154,13 +154,13 @@
}
},
{
- "type": "RigidBody",
+ "type": "RigidBody2D",
"data": {
"bodyType": 0
}
},
{
- "type": "BoxCollider",
+ "type": "BoxCollider2D",
"data": {
"halfExtents": {
"x": 0.8,
@@ -207,13 +207,13 @@
}
},
{
- "type": "RigidBody",
+ "type": "RigidBody2D",
"data": {
"bodyType": 0
}
},
{
- "type": "BoxCollider",
+ "type": "BoxCollider2D",
"data": {
"halfExtents": {
"x": 0.8,
@@ -260,13 +260,13 @@
}
},
{
- "type": "RigidBody",
+ "type": "RigidBody2D",
"data": {
"bodyType": 0
}
},
{
- "type": "BoxCollider",
+ "type": "BoxCollider2D",
"data": {
"halfExtents": {
"x": 1,
@@ -313,13 +313,13 @@
}
},
{
- "type": "RigidBody",
+ "type": "RigidBody2D",
"data": {
"bodyType": 0
}
},
{
- "type": "BoxCollider",
+ "type": "BoxCollider2D",
"data": {
"halfExtents": {
"x": 0.7,
@@ -350,13 +350,13 @@
}
},
{
- "type": "RigidBody",
+ "type": "RigidBody2D",
"data": {
"bodyType": 0
}
},
{
- "type": "BoxCollider",
+ "type": "BoxCollider2D",
"data": {
"halfExtents": {
"x": 0.1,
@@ -387,13 +387,13 @@
}
},
{
- "type": "RigidBody",
+ "type": "RigidBody2D",
"data": {
"bodyType": 0
}
},
{
- "type": "BoxCollider",
+ "type": "BoxCollider2D",
"data": {
"halfExtents": {
"x": 0.1,
@@ -444,13 +444,13 @@
"data": {}
},
{
- "type": "RigidBody",
+ "type": "RigidBody2D",
"data": {
"bodyType": 1
}
},
{
- "type": "BoxCollider",
+ "type": "BoxCollider2D",
"data": {
"halfExtents": {
"x": 0.16,
@@ -461,7 +461,7 @@
}
},
{
- "type": "CharacterController",
+ "type": "CharacterController2D",
"data": {
"maskBits": 65533
}
diff --git a/templates/2d-platformer/src/systems/player.ts b/templates/2d-platformer/src/systems/player.ts
index 4d4a9bc93..80919568a 100644
--- a/templates/2d-platformer/src/systems/player.ts
+++ b/templates/2d-platformer/src/systems/player.ts
@@ -1,13 +1,13 @@
import {
defineSystem, Query, Mut, Res, Time, Input,
- CharacterController,
+ CharacterController2D,
} from 'esengine';
import { Player } from '../components';
const GRAVITY = -1600;
export const playerSystem = defineSystem(
- [Query(Mut(CharacterController), Player), Res(Time), Res(Input)],
+ [Query(Mut(CharacterController2D), Player), Res(Time), Res(Input)],
(players, time, input) => {
for (const [_entity, cc, player] of players) {
let moveX = 0;
diff --git a/templates/3d-starter/assets/scenes/main.esscene b/templates/3d-starter/assets/scenes/main.esscene
index 14bee6ab2..19316bf42 100644
--- a/templates/3d-starter/assets/scenes/main.esscene
+++ b/templates/3d-starter/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"folders": [
"Lighting",
diff --git a/templates/blank/assets/scenes/main.esscene b/templates/blank/assets/scenes/main.esscene
index 929007828..9cc86e4c0 100644
--- a/templates/blank/assets/scenes/main.esscene
+++ b/templates/blank/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/templates/pixel-rpg/assets/scenes/main.esscene b/templates/pixel-rpg/assets/scenes/main.esscene
index 2aac063f8..194e04b36 100644
--- a/templates/pixel-rpg/assets/scenes/main.esscene
+++ b/templates/pixel-rpg/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
@@ -86,9 +86,9 @@
}
},
{ "type": "Player", "data": {} },
- { "type": "RigidBody", "data": { "bodyType": 1 } },
+ { "type": "RigidBody2D", "data": { "bodyType": 1 } },
{
- "type": "BoxCollider",
+ "type": "BoxCollider2D",
"data": {
"halfExtents": { "x": 0.05, "y": 0.035 },
"offset": { "x": 0, "y": -0.045 },
@@ -96,7 +96,7 @@
"maskBits": 65535
}
},
- { "type": "CharacterController", "data": { "maskBits": 65535 } }
+ { "type": "CharacterController2D", "data": { "maskBits": 65535 } }
],
"visible": true
},
diff --git a/templates/pixel-rpg/src/systems/move.ts b/templates/pixel-rpg/src/systems/move.ts
index 6f090e810..98d5321fa 100644
--- a/templates/pixel-rpg/src/systems/move.ts
+++ b/templates/pixel-rpg/src/systems/move.ts
@@ -1,11 +1,11 @@
import {
defineSystem, Query, Mut, Res, Input, GetWorld,
- CharacterController, SpriteAnimator,
+ CharacterController2D, SpriteAnimator,
} from 'esengine';
import { Facings, Player } from '../components';
export const moveSystem = defineSystem(
- [Query(Mut(CharacterController), SpriteAnimator, Facings, Player), Res(Input), GetWorld()],
+ [Query(Mut(CharacterController2D), SpriteAnimator, Facings, Player), Res(Input), GetWorld()],
(players, input, world) => {
let x = 0;
let y = 0;
diff --git a/templates/playable-ad/assets/scenes/main.esscene b/templates/playable-ad/assets/scenes/main.esscene
index dfc00368f..960d4e6f4 100644
--- a/templates/playable-ad/assets/scenes/main.esscene
+++ b/templates/playable-ad/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/templates/top-down/assets/scenes/main.esscene b/templates/top-down/assets/scenes/main.esscene
index ebe04181f..599fab243 100644
--- a/templates/top-down/assets/scenes/main.esscene
+++ b/templates/top-down/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"folders": [
"Level"
@@ -106,13 +106,13 @@
}
},
{
- "type": "RigidBody",
+ "type": "RigidBody2D",
"data": {
"bodyType": 0
}
},
{
- "type": "BoxCollider",
+ "type": "BoxCollider2D",
"data": {
"halfExtents": {
"x": 6.0,
@@ -161,13 +161,13 @@
}
},
{
- "type": "RigidBody",
+ "type": "RigidBody2D",
"data": {
"bodyType": 0
}
},
{
- "type": "BoxCollider",
+ "type": "BoxCollider2D",
"data": {
"halfExtents": {
"x": 6.0,
@@ -216,13 +216,13 @@
}
},
{
- "type": "RigidBody",
+ "type": "RigidBody2D",
"data": {
"bodyType": 0
}
},
{
- "type": "BoxCollider",
+ "type": "BoxCollider2D",
"data": {
"halfExtents": {
"x": 0.2,
@@ -271,13 +271,13 @@
}
},
{
- "type": "RigidBody",
+ "type": "RigidBody2D",
"data": {
"bodyType": 0
}
},
{
- "type": "BoxCollider",
+ "type": "BoxCollider2D",
"data": {
"halfExtents": {
"x": 0.2,
@@ -326,13 +326,13 @@
}
},
{
- "type": "RigidBody",
+ "type": "RigidBody2D",
"data": {
"bodyType": 0
}
},
{
- "type": "BoxCollider",
+ "type": "BoxCollider2D",
"data": {
"halfExtents": {
"x": 0.36,
@@ -381,13 +381,13 @@
}
},
{
- "type": "RigidBody",
+ "type": "RigidBody2D",
"data": {
"bodyType": 0
}
},
{
- "type": "BoxCollider",
+ "type": "BoxCollider2D",
"data": {
"halfExtents": {
"x": 0.36,
@@ -436,13 +436,13 @@
}
},
{
- "type": "RigidBody",
+ "type": "RigidBody2D",
"data": {
"bodyType": 0
}
},
{
- "type": "BoxCollider",
+ "type": "BoxCollider2D",
"data": {
"halfExtents": {
"x": 0.36,
@@ -494,13 +494,13 @@
"data": {}
},
{
- "type": "RigidBody",
+ "type": "RigidBody2D",
"data": {
"bodyType": 1
}
},
{
- "type": "BoxCollider",
+ "type": "BoxCollider2D",
"data": {
"halfExtents": {
"x": 0.18,
@@ -511,7 +511,7 @@
}
},
{
- "type": "CharacterController",
+ "type": "CharacterController2D",
"data": {
"maskBits": 65533
}
diff --git a/templates/top-down/src/systems/move.ts b/templates/top-down/src/systems/move.ts
index 838b21d60..d1f2228b2 100644
--- a/templates/top-down/src/systems/move.ts
+++ b/templates/top-down/src/systems/move.ts
@@ -1,6 +1,6 @@
import {
defineSystem, Query, Mut, Res, Input,
- CharacterController,
+ CharacterController2D,
} from 'esengine';
import { Player } from '../components';
@@ -9,7 +9,7 @@ import { Player } from '../components';
* ~1.4× faster than holding one — the oldest bug in top-down movement.
*/
export const moveSystem = defineSystem(
- [Query(Mut(CharacterController), Player), Res(Input)],
+ [Query(Mut(CharacterController2D), Player), Res(Input)],
(players, input) => {
let x = 0;
let y = 0;
diff --git a/templates/ui-game/assets/scenes/main.esscene b/templates/ui-game/assets/scenes/main.esscene
index 3c5ebd255..1b737e39b 100644
--- a/templates/ui-game/assets/scenes/main.esscene
+++ b/templates/ui-game/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/templates/wechat-minigame/assets/scenes/main.esscene b/templates/wechat-minigame/assets/scenes/main.esscene
index 558970be6..e5d30d179 100644
--- a/templates/wechat-minigame/assets/scenes/main.esscene
+++ b/templates/wechat-minigame/assets/scenes/main.esscene
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"name": "Main",
"entities": [
{
diff --git a/tools/apiSubsystems.mjs b/tools/apiSubsystems.mjs
index a3bac78a0..5eda34be3 100644
--- a/tools/apiSubsystems.mjs
+++ b/tools/apiSubsystems.mjs
@@ -117,7 +117,7 @@ export const SUBSYSTEMS = [
tier: 'beta',
why: 'the corpus reaches three of thirty-seven physics symbols',
whyZh: '语料只触到 37 个物理符号里的 3 个',
- entry: ['Physics', 'PhysicsEvents', 'CharacterController'],
+ entry: ['Physics', 'PhysicsEvents', 'CharacterController2D'],
},
{
id: 'camera',
diff --git a/tools/goldenProjects.mjs b/tools/goldenProjects.mjs
index 470b86ffe..bcbbcfcea 100644
--- a/tools/goldenProjects.mjs
+++ b/tools/goldenProjects.mjs
@@ -75,7 +75,7 @@ export const CAPABILITIES = [
* `null` = the claim is about the PACKAGE, so no source could show it.
*/
export const EVIDENCE = {
- physics: /\b(RigidBody|BoxCollider|CircleCollider|CapsuleCollider|physicsPlugin|CharacterController)\b/,
+ physics: /\b(RigidBody2D|BoxCollider2D|CircleCollider2D|CapsuleCollider2D|physicsPlugin|CharacterController2D)\b/,
input: /\b(Input|defineInputMap|isKeyDown|InputState)\b/,
animation: /\b(SpriteAnimator|Animator|spriteAnim|Flipbook|TimelinePlayer|AnimClip)\b/,
ecs: /\b(defineComponent|defineSystem)\b/,
diff --git a/tools/stress-project.mjs b/tools/stress-project.mjs
index f3c6062dd..0e28a1af3 100644
Binary files a/tools/stress-project.mjs and b/tools/stress-project.mjs differ