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.

wip(gameplay): a level to play, and the four gaps playing it found

esengine487d0c4e077f
diff --git a/examples/third-person-3d/assets/scenes/main.esscene b/examples/third-person-3d/assets/scenes/main.esscene
index 75db38e30..2a0a32181 100644
--- a/examples/third-person-3d/assets/scenes/main.esscene
+++ b/examples/third-person-3d/assets/scenes/main.esscene
@@ -1,6 +1,6 @@
{
"version": 4,
- "name": "ThirdPerson3D",
+ "name": "TidepoolRuins",
"entities": [
{
"id": 0,
@@ -25,7 +25,7 @@
"projectionType": 0,
"fov": 55,
"nearPlane": 10,
- "farPlane": 4000,
+ "farPlane": 9000,
"isActive": true,
"priority": 0
}
@@ -33,7 +33,7 @@
{
"type": "ThirdPersonCamera",
"data": {
- "target": 5,
+ "target": 1,
"distance": 420,
"pitch": 18
}
@@ -62,7 +62,1446 @@
},
{
"id": 1,
- "name": "Ground",
+ "name": "Player",
+ "parent": null,
+ "children": [
+ 2,
+ 3,
+ 4,
+ 48
+ ],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 60,
+ "z": 120
+ }
+ }
+ },
+ {
+ "type": "CharacterController3D",
+ "data": {
+ "radius": 30,
+ "halfHeight": 30,
+ "stepHeight": 40,
+ "snapDown": 50
+ }
+ },
+ {
+ "type": "ThirdPersonController",
+ "data": {
+ "camera": 0,
+ "moveSpeed": 320,
+ "jumpSpeed": 520,
+ "idleThreshold": 8
+ }
+ },
+ {
+ "type": "Animator",
+ "data": {
+ "controller": "assets/models/locomotion.esanimator",
+ "currentState": "",
+ "enabled": true
+ }
+ },
+ {
+ "type": "Runner",
+ "data": {}
+ },
+ {
+ "type": "AnimatorRootMotion",
+ "data": {
+ "enabled": true
+ }
+ },
+ {
+ "type": "MeleeAttack",
+ "data": {
+ "radius": 70,
+ "damage": 25,
+ "anchor": 49
+ }
+ },
+ {
+ "type": "Health",
+ "data": {
+ "current": 100,
+ "max": 100
+ }
+ },
+ {
+ "type": "PerceptionTarget",
+ "data": {}
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "name": "Bone0",
+ "parent": 1,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": -30,
+ "z": 0
+ }
+ }
+ }
+ ]
+ },
+ {
+ "id": 3,
+ "name": "Bone1",
+ "parent": 1,
+ "children": [
+ 49
+ ],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 30,
+ "z": 0
+ }
+ }
+ }
+ ]
+ },
+ {
+ "id": 4,
+ "name": "Body",
+ "parent": 1,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "assets/models/skinned-fade.esmesh",
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": false,
+ "color": {
+ "r": 0.82,
+ "g": 0.72,
+ "b": 0.55,
+ "a": 1
+ }
+ }
+ },
+ {
+ "type": "MeshSkin",
+ "data": {
+ "joints": [
+ 2,
+ 3
+ ]
+ }
+ }
+ ]
+ },
+ {
+ "id": 5,
+ "name": "Sun",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ },
+ "rotation": {
+ "w": 0.83394695,
+ "x": -0.52086316,
+ "y": 0.18230211,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Light",
+ "data": {
+ "type": 1,
+ "intensity": 1.05,
+ "enabled": true,
+ "color": {
+ "r": 1,
+ "g": 0.96,
+ "b": 0.9,
+ "a": 1
+ }
+ }
+ }
+ ]
+ },
+ {
+ "id": 6,
+ "name": "Sky",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Light",
+ "data": {
+ "type": 2,
+ "intensity": 0.45,
+ "enabled": true,
+ "color": {
+ "r": 0.55,
+ "g": 0.66,
+ "b": 0.85,
+ "a": 1
+ }
+ }
+ }
+ ]
+ },
+ {
+ "id": 7,
+ "name": "Clearing",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": -20,
+ "z": 60
+ },
+ "scale": {
+ "x": 9,
+ "y": 0.4,
+ "z": 5
+ }
+ }
+ },
+ {
+ "type": "RigidBody3D",
+ "data": {
+ "bodyType": 0
+ }
+ },
+ {
+ "type": "BoxCollider3D",
+ "data": {
+ "halfExtents": {
+ "x": 450,
+ "y": 20,
+ "z": 250
+ },
+ "friction": 0.7
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "color": {
+ "r": 0.27,
+ "g": 0.36,
+ "b": 0.26,
+ "a": 1
+ }
+ }
+ }
+ ]
+ },
+ {
+ "id": 8,
+ "name": "Trunk0",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -360,
+ "y": 90,
+ "z": -60
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 2.2,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "color": {
+ "r": 0.24,
+ "g": 0.19,
+ "b": 0.15,
+ "a": 1
+ }
+ }
+ }
+ ]
+ },
+ {
+ "id": 9,
+ "name": "Canopy0",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -360,
+ "y": 240,
+ "z": -60
+ },
+ "scale": {
+ "x": 1.8,
+ "y": 0.9,
+ "z": 1.8
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "color": {
+ "r": 0.2,
+ "g": 0.42,
+ "b": 0.24,
+ "a": 1
+ }
+ }
+ }
+ ]
+ },
+ {
+ "id": 10,
+ "name": "Trunk1",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 340,
+ "y": 90,
+ "z": -150
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 2.2,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "color": {
+ "r": 0.24,
+ "g": 0.19,
+ "b": 0.15,
+ "a": 1
+ }
+ }
+ }
+ ]
+ },
+ {
+ "id": 11,
+ "name": "Canopy1",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 340,
+ "y": 240,
+ "z": -150
+ },
+ "scale": {
+ "x": 1.8,
+ "y": 0.9,
+ "z": 1.8
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "color": {
+ "r": 0.2,
+ "g": 0.42,
+ "b": 0.24,
+ "a": 1
+ }
+ }
+ }
+ ]
+ },
+ {
+ "id": 12,
+ "name": "Trunk2",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -300,
+ "y": 90,
+ "z": -240
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 2.2,
+ "z": 0.4
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "color": {
+ "r": 0.24,
+ "g": 0.19,
+ "b": 0.15,
+ "a": 1
+ }
+ }
+ }
+ ]
+ },
+ {
+ "id": 13,
+ "name": "Canopy2",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -300,
+ "y": 240,
+ "z": -240
+ },
+ "scale": {
+ "x": 1.8,
+ "y": 0.9,
+ "z": 1.8
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "color": {
+ "r": 0.2,
+ "g": 0.42,
+ "b": 0.24,
+ "a": 1
+ }
+ }
+ }
+ ]
+ },
+ {
+ "id": 14,
+ "name": "Stair0",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 15,
+ "z": -240
+ },
+ "scale": {
+ "x": 5.2,
+ "y": 0.4,
+ "z": 1.3
+ }
+ }
+ },
+ {
+ "type": "RigidBody3D",
+ "data": {
+ "bodyType": 0
+ }
+ },
+ {
+ "type": "BoxCollider3D",
+ "data": {
+ "halfExtents": {
+ "x": 260,
+ "y": 20,
+ "z": 65
+ },
+ "friction": 0.7
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "color": {
+ "r": 0.42,
+ "g": 0.44,
+ "b": 0.47,
+ "a": 1
+ }
+ }
+ }
+ ]
+ },
+ {
+ "id": 15,
+ "name": "Stair1",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 50,
+ "z": -370
+ },
+ "scale": {
+ "x": 5.2,
+ "y": 0.4,
+ "z": 1.3
+ }
+ }
+ },
+ {
+ "type": "RigidBody3D",
+ "data": {
+ "bodyType": 0
+ }
+ },
+ {
+ "type": "BoxCollider3D",
+ "data": {
+ "halfExtents": {
+ "x": 260,
+ "y": 20,
+ "z": 65
+ },
+ "friction": 0.7
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "color": {
+ "r": 0.42,
+ "g": 0.44,
+ "b": 0.47,
+ "a": 1
+ }
+ }
+ }
+ ]
+ },
+ {
+ "id": 16,
+ "name": "Stair2",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 85,
+ "z": -500
+ },
+ "scale": {
+ "x": 5.2,
+ "y": 0.4,
+ "z": 1.3
+ }
+ }
+ },
+ {
+ "type": "RigidBody3D",
+ "data": {
+ "bodyType": 0
+ }
+ },
+ {
+ "type": "BoxCollider3D",
+ "data": {
+ "halfExtents": {
+ "x": 260,
+ "y": 20,
+ "z": 65
+ },
+ "friction": 0.7
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "color": {
+ "r": 0.42,
+ "g": 0.44,
+ "b": 0.47,
+ "a": 1
+ }
+ }
+ }
+ ]
+ },
+ {
+ "id": 17,
+ "name": "Stair3",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 120,
+ "z": -630
+ },
+ "scale": {
+ "x": 5.2,
+ "y": 0.4,
+ "z": 1.3
+ }
+ }
+ },
+ {
+ "type": "RigidBody3D",
+ "data": {
+ "bodyType": 0
+ }
+ },
+ {
+ "type": "BoxCollider3D",
+ "data": {
+ "halfExtents": {
+ "x": 260,
+ "y": 20,
+ "z": 65
+ },
+ "friction": 0.7
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "color": {
+ "r": 0.42,
+ "g": 0.44,
+ "b": 0.47,
+ "a": 1
+ }
+ }
+ }
+ ]
+ },
+ {
+ "id": 18,
+ "name": "Shelf",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 120,
+ "z": -830
+ },
+ "scale": {
+ "x": 5.2,
+ "y": 0.4,
+ "z": 2.6
+ }
+ }
+ },
+ {
+ "type": "RigidBody3D",
+ "data": {
+ "bodyType": 0
+ }
+ },
+ {
+ "type": "BoxCollider3D",
+ "data": {
+ "halfExtents": {
+ "x": 260,
+ "y": 20,
+ "z": 130
+ },
+ "friction": 0.7
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "color": {
+ "r": 0.42,
+ "g": 0.44,
+ "b": 0.47,
+ "a": 1
+ }
+ }
+ }
+ ]
+ },
+ {
+ "id": 19,
+ "name": "GapLanding",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 120,
+ "z": -1200
+ },
+ "scale": {
+ "x": 4.6,
+ "y": 0.4,
+ "z": 2.6
+ }
+ }
+ },
+ {
+ "type": "RigidBody3D",
+ "data": {
+ "bodyType": 0
+ }
+ },
+ {
+ "type": "BoxCollider3D",
+ "data": {
+ "halfExtents": {
+ "x": 230,
+ "y": 20,
+ "z": 130
+ },
+ "friction": 0.7
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "color": {
+ "r": 0.42,
+ "g": 0.44,
+ "b": 0.47,
+ "a": 1
+ }
+ }
+ }
+ ]
+ },
+ {
+ "id": 20,
+ "name": "Bridge",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 120,
+ "z": -1560
+ },
+ "scale": {
+ "x": 1.5,
+ "y": 0.3,
+ "z": 4.8
+ }
+ }
+ },
+ {
+ "type": "RigidBody3D",
+ "data": {
+ "bodyType": 0
+ }
+ },
+ {
+ "type": "BoxCollider3D",
+ "data": {
+ "halfExtents": {
+ "x": 75,
+ "y": 15,
+ "z": 240
+ },
+ "friction": 0.7
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "color": {
+ "r": 0.3,
+ "g": 0.32,
+ "b": 0.35,
+ "a": 1
+ }
+ }
+ }
+ ]
+ },
+ {
+ "id": 21,
+ "name": "BridgeEnd",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 120,
+ "z": -1900
+ },
+ "scale": {
+ "x": 4.6,
+ "y": 0.4,
+ "z": 2.4
+ }
+ }
+ },
+ {
+ "type": "RigidBody3D",
+ "data": {
+ "bodyType": 0
+ }
+ },
+ {
+ "type": "BoxCollider3D",
+ "data": {
+ "halfExtents": {
+ "x": 230,
+ "y": 20,
+ "z": 120
+ },
+ "friction": 0.7
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "color": {
+ "r": 0.42,
+ "g": 0.44,
+ "b": 0.47,
+ "a": 1
+ }
+ }
+ }
+ ]
+ },
+ {
+ "id": 22,
+ "name": "CorridorFloor",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 120,
+ "z": -2250
+ },
+ "scale": {
+ "x": 4.2,
+ "y": 0.4,
+ "z": 4.8
+ }
+ }
+ },
+ {
+ "type": "RigidBody3D",
+ "data": {
+ "bodyType": 0
+ }
+ },
+ {
+ "type": "BoxCollider3D",
+ "data": {
+ "halfExtents": {
+ "x": 210,
+ "y": 20,
+ "z": 240
+ },
+ "friction": 0.7
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "color": {
+ "r": 0.5,
+ "g": 0.46,
+ "b": 0.38,
+ "a": 1
+ }
+ }
+ }
+ ]
+ },
+ {
+ "id": 23,
+ "name": "CorridorL",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -230,
+ "y": 230,
+ "z": -2250
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 2.2,
+ "z": 4.8
+ }
+ }
+ },
+ {
+ "type": "RigidBody3D",
+ "data": {
+ "bodyType": 0
+ }
+ },
+ {
+ "type": "BoxCollider3D",
+ "data": {
+ "halfExtents": {
+ "x": 20,
+ "y": 110,
+ "z": 240
+ },
+ "friction": 0.7
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "color": {
+ "r": 0.5,
+ "g": 0.46,
+ "b": 0.38,
+ "a": 1
+ }
+ }
+ }
+ ]
+ },
+ {
+ "id": 24,
+ "name": "CorridorR",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 230,
+ "y": 230,
+ "z": -2250
+ },
+ "scale": {
+ "x": 0.4,
+ "y": 2.2,
+ "z": 4.8
+ }
+ }
+ },
+ {
+ "type": "RigidBody3D",
+ "data": {
+ "bodyType": 0
+ }
+ },
+ {
+ "type": "BoxCollider3D",
+ "data": {
+ "halfExtents": {
+ "x": 20,
+ "y": 110,
+ "z": 240
+ },
+ "friction": 0.7
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "color": {
+ "r": 0.5,
+ "g": 0.46,
+ "b": 0.38,
+ "a": 1
+ }
+ }
+ }
+ ]
+ },
+ {
+ "id": 25,
+ "name": "Scorch",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 142,
+ "z": -2250
+ },
+ "scale": {
+ "x": 3.4,
+ "y": 0.04,
+ "z": 3.2
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "color": {
+ "r": 0.62,
+ "g": 0.2,
+ "b": 0.22,
+ "a": 1
+ }
+ }
+ },
+ {
+ "type": "Hazard",
+ "data": {
+ "halfX": 190,
+ "halfZ": 240,
+ "damagePerSecond": 34
+ }
+ }
+ ]
+ },
+ {
+ "id": 26,
+ "name": "DownRamp",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 60,
+ "z": -2620
+ },
+ "scale": {
+ "x": 4.2,
+ "y": 0.4,
+ "z": 4.2
+ },
+ "rotation": {
+ "w": 0.98325491,
+ "x": 0.18223553,
+ "y": 0,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "RigidBody3D",
+ "data": {
+ "bodyType": 0
+ }
+ },
+ {
+ "type": "BoxCollider3D",
+ "data": {
+ "halfExtents": {
+ "x": 210,
+ "y": 20,
+ "z": 210
+ },
+ "friction": 0.7
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "color": {
+ "r": 0.42,
+ "g": 0.44,
+ "b": 0.47,
+ "a": 1
+ }
+ }
+ }
+ ]
+ },
+ {
+ "id": 27,
+ "name": "Plaza",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": -20,
+ "z": -3150
+ },
+ "scale": {
+ "x": 12,
+ "y": 0.4,
+ "z": 7
+ }
+ }
+ },
+ {
+ "type": "RigidBody3D",
+ "data": {
+ "bodyType": 0
+ }
+ },
+ {
+ "type": "BoxCollider3D",
+ "data": {
+ "halfExtents": {
+ "x": 600,
+ "y": 20,
+ "z": 350
+ },
+ "friction": 0.7
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "color": {
+ "r": 0.5,
+ "g": 0.46,
+ "b": 0.38,
+ "a": 1
+ }
+ }
+ }
+ ]
+ },
+ {
+ "id": 28,
+ "name": "Pillar0",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -430,
+ "y": 130,
+ "z": -3320
+ },
+ "scale": {
+ "x": 0.7,
+ "y": 2.6,
+ "z": 0.7
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "color": {
+ "r": 0.5,
+ "g": 0.46,
+ "b": 0.38,
+ "a": 1
+ }
+ }
+ }
+ ]
+ },
+ {
+ "id": 29,
+ "name": "Pillar1",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 440,
+ "y": 130,
+ "z": -3320
+ },
+ "scale": {
+ "x": 0.7,
+ "y": 2.6,
+ "z": 0.7
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "color": {
+ "r": 0.5,
+ "g": 0.46,
+ "b": 0.38,
+ "a": 1
+ }
+ }
+ }
+ ]
+ },
+ {
+ "id": 30,
+ "name": "Plinth",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -380,
+ "y": 40,
+ "z": -2980
+ },
+ "scale": {
+ "x": 2.2,
+ "y": 0.8,
+ "z": 2.2
+ }
+ }
+ },
+ {
+ "type": "RigidBody3D",
+ "data": {
+ "bodyType": 0
+ }
+ },
+ {
+ "type": "BoxCollider3D",
+ "data": {
+ "halfExtents": {
+ "x": 110,
+ "y": 40,
+ "z": 110
+ },
+ "friction": 0.7
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "color": {
+ "r": 0.42,
+ "g": 0.44,
+ "b": 0.47,
+ "a": 1
+ }
+ }
+ }
+ ]
+ },
+ {
+ "id": 31,
+ "name": "CoreA",
"parent": null,
"children": [],
"visible": true,
@@ -71,54 +1510,98 @@
"type": "Transform",
"data": {
"position": {
- "x": -200,
- "y": -20,
- "z": -300
+ "x": 0,
+ "y": 55,
+ "z": -3120
},
"scale": {
- "x": 30.0,
+ "x": 0.4,
"y": 0.4,
- "z": 24.0
+ "z": 0.4
}
}
},
{
- "type": "RigidBody3D",
+ "type": "MeshRenderer",
"data": {
- "bodyType": 0
+ "mesh": "builtin:sphere",
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "color": {
+ "r": 0.35,
+ "g": 0.85,
+ "b": 0.95,
+ "a": 1
+ }
}
},
{
- "type": "BoxCollider3D",
+ "type": "Core",
+ "data": {}
+ },
+ {
+ "type": "Reachable",
"data": {
- "halfExtents": {
- "x": 1500.0,
- "y": 20.0,
- "z": 1200.0
+ "radius": 110,
+ "prompt": "take the core"
+ }
+ }
+ ]
+ },
+ {
+ "id": 32,
+ "name": "CoreB",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -380,
+ "y": 115,
+ "z": -2980
},
- "friction": 0.6
+ "scale": {
+ "x": 0.4,
+ "y": 0.4,
+ "z": 0.4
+ }
}
},
{
"type": "MeshRenderer",
"data": {
- "mesh": "builtin:cube",
- "lit": true,
+ "mesh": "builtin:sphere",
+ "lit": false,
"opaque": true,
"cullBackfaces": true,
"color": {
- "r": 0.3,
- "g": 0.34,
- "b": 0.3,
+ "r": 0.35,
+ "g": 0.85,
+ "b": 0.95,
"a": 1
}
}
+ },
+ {
+ "type": "Core",
+ "data": {}
+ },
+ {
+ "type": "Reachable",
+ "data": {
+ "radius": 110,
+ "prompt": "take the core"
+ }
}
]
},
{
- "id": 2,
- "name": "Wall",
+ "id": 33,
+ "name": "CoreC",
"parent": null,
"children": [],
"visible": true,
@@ -127,17 +1610,67 @@
"type": "Transform",
"data": {
"position": {
- "x": 420,
- "y": 120,
- "z": -520
+ "x": 430,
+ "y": 55,
+ "z": -3330
},
"scale": {
- "x": 3.0,
- "y": 2.4,
+ "x": 0.4,
+ "y": 0.4,
"z": 0.4
}
}
},
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:sphere",
+ "lit": false,
+ "opaque": true,
+ "cullBackfaces": true,
+ "color": {
+ "r": 0.35,
+ "g": 0.85,
+ "b": 0.95,
+ "a": 1
+ }
+ }
+ },
+ {
+ "type": "Core",
+ "data": {}
+ },
+ {
+ "type": "Reachable",
+ "data": {
+ "radius": 110,
+ "prompt": "take the core"
+ }
+ }
+ ]
+ },
+ {
+ "id": 34,
+ "name": "GateFrameL",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -160,
+ "y": 120,
+ "z": -3480
+ },
+ "scale": {
+ "x": 0.7,
+ "y": 2.8,
+ "z": 0.7
+ }
+ }
+ },
{
"type": "RigidBody3D",
"data": {
@@ -148,11 +1681,11 @@
"type": "BoxCollider3D",
"data": {
"halfExtents": {
- "x": 150.0,
- "y": 120.0,
- "z": 20.0
+ "x": 35,
+ "y": 140,
+ "z": 35
},
- "friction": 0.6
+ "friction": 0.7
}
},
{
@@ -163,9 +1696,9 @@
"opaque": true,
"cullBackfaces": true,
"color": {
- "r": 0.45,
- "g": 0.3,
- "b": 0.28,
+ "r": 0.55,
+ "g": 0.45,
+ "b": 0.7,
"a": 1
}
}
@@ -173,8 +1706,8 @@
]
},
{
- "id": 3,
- "name": "Step",
+ "id": 35,
+ "name": "GateFrameR",
"parent": null,
"children": [],
"visible": true,
@@ -183,14 +1716,14 @@
"type": "Transform",
"data": {
"position": {
- "x": -400,
- "y": 15,
- "z": -520
+ "x": 160,
+ "y": 120,
+ "z": -3480
},
"scale": {
- "x": 3.0,
- "y": 0.3,
- "z": 4.0
+ "x": 0.7,
+ "y": 2.8,
+ "z": 0.7
}
}
},
@@ -204,11 +1737,11 @@
"type": "BoxCollider3D",
"data": {
"halfExtents": {
- "x": 150.0,
- "y": 15.0,
- "z": 200.0
+ "x": 35,
+ "y": 140,
+ "z": 35
},
- "friction": 0.6
+ "friction": 0.7
}
},
{
@@ -219,9 +1752,9 @@
"opaque": true,
"cullBackfaces": true,
"color": {
- "r": 0.36,
- "g": 0.32,
- "b": 0.28,
+ "r": 0.55,
+ "g": 0.45,
+ "b": 0.7,
"a": 1
}
}
@@ -229,8 +1762,8 @@
]
},
{
- "id": 4,
- "name": "Ramp",
+ "id": 36,
+ "name": "Gate",
"parent": null,
"children": [],
"visible": true,
@@ -240,66 +1773,49 @@
"data": {
"position": {
"x": 0,
- "y": 40,
- "z": -520
- },
- "rotation": {
- "w": 0.9945218953682733,
- "x": 0.10452846326765347,
- "y": 0,
- "z": 0
+ "y": 100,
+ "z": -3480
},
"scale": {
- "x": 3.0,
- "y": 0.3,
- "z": 8.0
+ "x": 2.5,
+ "y": 2,
+ "z": 0.2
}
}
},
- {
- "type": "RigidBody3D",
- "data": {
- "bodyType": 0
- }
- },
- {
- "type": "BoxCollider3D",
- "data": {
- "halfExtents": {
- "x": 150.0,
- "y": 15.0,
- "z": 400.0
- },
- "friction": 0.6
- }
- },
{
"type": "MeshRenderer",
"data": {
"mesh": "builtin:cube",
- "lit": true,
+ "lit": false,
"opaque": true,
"cullBackfaces": true,
"color": {
- "r": 0.33,
- "g": 0.36,
- "b": 0.4,
+ "r": 0.18,
+ "g": 0.16,
+ "b": 0.24,
"a": 1
}
}
+ },
+ {
+ "type": "Gate",
+ "data": {}
+ },
+ {
+ "type": "Reachable",
+ "data": {
+ "radius": 170,
+ "prompt": "open the archive"
+ }
}
]
},
{
- "id": 5,
- "name": "Player",
+ "id": 37,
+ "name": "CheckStart",
"parent": null,
- "children": [
- 6,
- 7,
- 8,
- 13
- ],
+ "children": [],
"visible": true,
"components": [
{
@@ -307,68 +1823,98 @@
"data": {
"position": {
"x": 0,
- "y": 80,
+ "y": 60,
"z": 120
}
}
},
{
- "type": "CharacterController3D",
+ "type": "Checkpoint",
"data": {
- "radius": 30,
- "halfHeight": 30,
- "stepHeight": 40,
- "snapDown": 50
+ "armZ": 200
}
- },
+ }
+ ]
+ },
+ {
+ "id": 38,
+ "name": "CheckShelf",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
{
- "type": "ThirdPersonController",
+ "type": "Transform",
"data": {
- "camera": 0,
- "moveSpeed": 320,
- "jumpSpeed": 520,
- "idleThreshold": 8
+ "position": {
+ "x": 0,
+ "y": 180,
+ "z": -830
+ }
}
},
{
- "type": "Animator",
+ "type": "Checkpoint",
"data": {
- "controller": "assets/models/locomotion.esanimator",
- "currentState": "",
- "enabled": true
+ "armZ": -740
}
- },
+ }
+ ]
+ },
+ {
+ "id": 39,
+ "name": "CheckGap",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
{
- "type": "AnimatorRootMotion",
+ "type": "Transform",
"data": {
- "enabled": true
+ "position": {
+ "x": 0,
+ "y": 180,
+ "z": -1200
+ }
}
},
{
- "type": "MeleeAttack",
+ "type": "Checkpoint",
"data": {
- "radius": 70,
- "damage": 25,
- "anchor": 15
+ "armZ": -1120
}
- },
+ }
+ ]
+ },
+ {
+ "id": 40,
+ "name": "CheckBridge",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
{
- "type": "Health",
+ "type": "Transform",
"data": {
- "current": 100,
- "max": 100
+ "position": {
+ "x": 0,
+ "y": 180,
+ "z": -1900
+ }
}
},
{
- "type": "PerceptionTarget",
- "data": {}
+ "type": "Checkpoint",
+ "data": {
+ "armZ": -1820
+ }
}
]
},
{
- "id": 6,
- "name": "Bone0",
- "parent": 5,
+ "id": 41,
+ "name": "CheckPlaza",
+ "parent": null,
"children": [],
"visible": true,
"components": [
@@ -377,19 +1923,28 @@
"data": {
"position": {
"x": 0,
- "y": 0,
- "z": 0
+ "y": 40,
+ "z": -2900
}
}
+ },
+ {
+ "type": "Checkpoint",
+ "data": {
+ "armZ": -2850
+ }
}
]
},
{
- "id": 7,
- "name": "Bone1",
- "parent": 5,
+ "id": 42,
+ "name": "HUD",
+ "parent": null,
"children": [
- 15
+ 43,
+ 45,
+ 46,
+ 47
],
"visible": true,
"components": [
@@ -397,19 +1952,35 @@
"type": "Transform",
"data": {
"position": {
- "x": 60,
+ "x": 0,
"y": 0,
"z": 0
}
}
+ },
+ {
+ "type": "Canvas",
+ "data": {
+ "designResolution": {
+ "x": 960,
+ "y": 640
+ },
+ "scaleMode": 2
+ }
+ },
+ {
+ "type": "UINode",
+ "data": {}
}
]
},
{
- "id": 8,
- "name": "Body",
- "parent": 5,
- "children": [],
+ "id": 43,
+ "name": "HealthTrack",
+ "parent": 42,
+ "children": [
+ 44
+ ],
"visible": true,
"components": [
{
@@ -423,34 +1994,46 @@
}
},
{
- "type": "MeshRenderer",
+ "type": "UINode",
"data": {
- "mesh": "assets/models/skinned-fade.esmesh",
- "lit": true,
- "opaque": true,
- "color": {
- "r": 0.35,
- "g": 0.75,
- "b": 0.45,
- "a": 1
+ "position": 1,
+ "insetLeft": {
+ "value": 24,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 24,
+ "unit": 0
+ },
+ "width": {
+ "value": 240,
+ "unit": 0
+ },
+ "height": {
+ "value": 18,
+ "unit": 0
}
}
},
{
- "type": "MeshSkin",
+ "type": "UIVisual",
"data": {
- "joints": [
- 6,
- 7
- ]
+ "visualType": 1,
+ "color": {
+ "r": 0.07,
+ "g": 0.07,
+ "b": 0.1,
+ "a": 0.85
+ },
+ "enabled": true
}
}
]
- },
- {
- "id": 9,
- "name": "Sun",
- "parent": null,
+ },
+ {
+ "id": 44,
+ "name": "HealthFill",
+ "parent": 43,
"children": [],
"visible": true,
"components": [
@@ -461,35 +2044,57 @@
"x": 0,
"y": 0,
"z": 0
+ }
+ }
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "position": 1,
+ "insetLeft": {
+ "value": 0,
+ "unit": 0
},
- "rotation": {
- "w": 0.83394695,
- "x": -0.52086316,
- "y": 0.18230211,
- "z": 0
+ "insetTop": {
+ "value": 0,
+ "unit": 0
+ },
+ "insetRight": {
+ "value": 0,
+ "unit": 0
+ },
+ "insetBottom": {
+ "value": 0,
+ "unit": 0
}
}
},
{
- "type": "Light",
+ "type": "UIVisual",
"data": {
- "type": 1,
- "intensity": 1.05,
- "enabled": true,
+ "visualType": 5,
+ "fillMethod": 0,
+ "fillOrigin": 0,
+ "fillAmount": 1,
"color": {
- "r": 1,
- "g": 0.96,
- "b": 0.9,
+ "r": 0.85,
+ "g": 0.32,
+ "b": 0.34,
"a": 1
- }
+ },
+ "enabled": true
}
+ },
+ {
+ "type": "HealthMeter",
+ "data": {}
}
]
},
{
- "id": 10,
- "name": "Sky",
- "parent": null,
+ "id": 45,
+ "name": "ObjectiveLabel",
+ "parent": 42,
"children": [],
"visible": true,
"components": [
@@ -504,25 +2109,52 @@
}
},
{
- "type": "Light",
+ "type": "UINode",
"data": {
- "type": 2,
- "intensity": 0.42,
- "enabled": true,
+ "position": 1,
+ "insetLeft": {
+ "value": 24,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 52,
+ "unit": 0
+ },
+ "width": {
+ "value": 560,
+ "unit": 0
+ },
+ "height": {
+ "value": 28,
+ "unit": 0
+ }
+ }
+ },
+ {
+ "type": "Text",
+ "data": {
+ "content": "",
+ "fontSize": 20,
"color": {
- "r": 0.55,
- "g": 0.66,
- "b": 0.85,
+ "r": 0.92,
+ "g": 0.93,
+ "b": 0.96,
"a": 1
- }
+ },
+ "align": 0,
+ "verticalAlign": 0
}
+ },
+ {
+ "type": "ObjectiveText",
+ "data": {}
}
]
},
{
- "id": 11,
- "name": "HighStep",
- "parent": null,
+ "id": 46,
+ "name": "PromptLabel",
+ "parent": 42,
"children": [],
"visible": true,
"components": [
@@ -530,55 +2162,59 @@
"type": "Transform",
"data": {
"position": {
- "x": -800,
- "y": 45,
- "z": -520
- },
- "scale": {
- "x": 3.0,
- "y": 0.9,
- "z": 4.0
+ "x": 0,
+ "y": 0,
+ "z": 0
}
}
},
{
- "type": "RigidBody3D",
- "data": {
- "bodyType": 0
- }
- },
- {
- "type": "BoxCollider3D",
+ "type": "UINode",
"data": {
- "halfExtents": {
- "x": 150,
- "y": 45,
- "z": 200
+ "position": 1,
+ "insetLeft": {
+ "value": 0,
+ "unit": 0
+ },
+ "insetRight": {
+ "value": 0,
+ "unit": 0
+ },
+ "insetBottom": {
+ "value": 64,
+ "unit": 0
},
- "friction": 0.6
+ "height": {
+ "value": 26,
+ "unit": 0
+ }
}
},
{
- "type": "MeshRenderer",
+ "type": "Text",
"data": {
- "mesh": "builtin:cube",
- "lit": true,
- "opaque": true,
- "cullBackfaces": true,
+ "content": "",
+ "fontSize": 19,
"color": {
- "r": 0.45,
- "g": 0.28,
- "b": 0.3,
+ "r": 0.62,
+ "g": 0.9,
+ "b": 0.98,
"a": 1
- }
+ },
+ "align": 1,
+ "verticalAlign": 1
}
+ },
+ {
+ "type": "PromptText",
+ "data": {}
}
]
},
{
- "id": 12,
- "name": "BackWall",
- "parent": null,
+ "id": 47,
+ "name": "OverlayLabel",
+ "parent": 42,
"children": [],
"visible": true,
"components": [
@@ -586,55 +2222,59 @@
"type": "Transform",
"data": {
"position": {
- "x": 420,
- "y": 120,
- "z": 400
- },
- "scale": {
- "x": 4.0,
- "y": 2.4,
- "z": 0.4
+ "x": 0,
+ "y": 0,
+ "z": 0
}
}
},
{
- "type": "RigidBody3D",
- "data": {
- "bodyType": 0
- }
- },
- {
- "type": "BoxCollider3D",
+ "type": "UINode",
"data": {
- "halfExtents": {
- "x": 200,
- "y": 120,
- "z": 20
+ "position": 1,
+ "insetLeft": {
+ "value": 0,
+ "unit": 0
+ },
+ "insetRight": {
+ "value": 0,
+ "unit": 0
},
- "friction": 0.6
+ "insetTop": {
+ "value": 0,
+ "unit": 0
+ },
+ "insetBottom": {
+ "value": 0,
+ "unit": 0
+ }
}
},
{
- "type": "MeshRenderer",
+ "type": "Text",
"data": {
- "mesh": "builtin:cube",
- "lit": true,
- "opaque": true,
- "cullBackfaces": true,
+ "content": "",
+ "fontSize": 30,
"color": {
- "r": 0.4,
- "g": 0.34,
- "b": 0.44,
+ "r": 1,
+ "g": 1,
+ "b": 1,
"a": 1
- }
+ },
+ "align": 1,
+ "verticalAlign": 1
}
+ },
+ {
+ "type": "OverlayText",
+ "data": {}
}
]
},
{
- "id": 13,
+ "id": 48,
"name": "FootDust",
- "parent": 5,
+ "parent": 1,
"children": [],
"visible": true,
"components": [
@@ -695,7 +2335,26 @@
]
},
{
- "id": 14,
+ "id": 49,
+ "name": "HitAnchor",
+ "parent": 3,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 80,
+ "y": 0,
+ "z": 0
+ }
+ }
+ }
+ ]
+ },
+ {
+ "id": 50,
"name": "AirMotes",
"parent": null,
"children": [],
@@ -706,8 +2365,8 @@
"data": {
"position": {
"x": 0,
- "y": 220,
- "z": -400
+ "y": 260,
+ "z": -1600
}
}
},
@@ -756,9 +2415,9 @@
]
},
{
- "id": 15,
- "name": "HitAnchor",
- "parent": 7,
+ "id": 51,
+ "name": "HitSpark",
+ "parent": null,
"children": [],
"visible": true,
"components": [
@@ -766,16 +2425,59 @@
"type": "Transform",
"data": {
"position": {
- "x": 80,
- "y": 0,
+ "x": 0,
+ "y": -4000,
"z": 0
}
}
+ },
+ {
+ "type": "ParticleEmitter",
+ "data": {
+ "rate": 0,
+ "burstCount": 18,
+ "burstInterval": 0,
+ "duration": 0.05,
+ "looping": false,
+ "playOnStart": false,
+ "maxParticles": 72,
+ "lifetimeMin": 0.5,
+ "lifetimeMax": 0.9,
+ "shape": 4,
+ "shapeRadius": 12,
+ "speedMin": 90,
+ "speedMax": 240,
+ "startSizeMin": 8,
+ "startSizeMax": 14,
+ "endSizeMin": 0,
+ "endSizeMax": 4,
+ "startColor": {
+ "r": 1.0,
+ "g": 0.82,
+ "b": 0.45,
+ "a": 1.0
+ },
+ "endColor": {
+ "r": 0.95,
+ "g": 0.32,
+ "b": 0.2,
+ "a": 0.0
+ },
+ "gravity": {
+ "x": 0,
+ "y": -320,
+ "z": 0
+ },
+ "damping": 2.0,
+ "blendMode": 1,
+ "layer": 0,
+ "simulationSpace": 0
+ }
}
]
},
{
- "id": 18,
+ "id": 52,
"name": "DummyB",
"parent": null,
"children": [],
@@ -785,9 +2487,9 @@
"type": "Transform",
"data": {
"position": {
- "x": -129,
+ "x": -260,
"y": 60,
- "z": 17
+ "z": 20
}
}
},
@@ -833,75 +2535,16 @@
]
},
{
- "id": 19,
- "name": "HitSpark",
- "parent": null,
- "children": [],
- "visible": true,
- "components": [
- {
- "type": "Transform",
- "data": {
- "position": {
- "x": 0,
- "y": -4000,
- "z": 0
- }
- }
- },
- {
- "type": "ParticleEmitter",
- "data": {
- "rate": 0,
- "burstCount": 18,
- "burstInterval": 0,
- "duration": 0.05,
- "looping": false,
- "playOnStart": false,
- "maxParticles": 72,
- "lifetimeMin": 0.5,
- "lifetimeMax": 0.9,
- "shape": 4,
- "shapeRadius": 12,
- "speedMin": 90,
- "speedMax": 240,
- "startSizeMin": 8,
- "startSizeMax": 14,
- "endSizeMin": 0,
- "endSizeMax": 4,
- "startColor": {
- "r": 1.0,
- "g": 0.82,
- "b": 0.45,
- "a": 1.0
- },
- "endColor": {
- "r": 0.95,
- "g": 0.32,
- "b": 0.2,
- "a": 0.0
- },
- "gravity": {
- "x": 0,
- "y": -320,
- "z": 0
- },
- "damping": 2.0,
- "blendMode": 1,
- "layer": 0,
- "simulationSpace": 0
- }
- }
- ]
- },
- {
- "id": 20,
+ "id": 53,
"name": "Enemy",
"parent": null,
"children": [
- 21,
- 22,
- 23
+ 54,
+ 55,
+ 56,
+ 54,
+ 55,
+ 56
],
"visible": true,
"components": [
@@ -909,9 +2552,9 @@
"type": "Transform",
"data": {
"position": {
- "x": 129,
+ "x": 240,
"y": 60,
- "z": 17
+ "z": -3210
}
}
},
@@ -965,7 +2608,7 @@
"data": {
"radius": 110,
"damage": 20,
- "anchor": 24
+ "anchor": 57
}
},
{
@@ -978,9 +2621,9 @@
]
},
{
- "id": 21,
+ "id": 54,
"name": "Bone0",
- "parent": 20,
+ "parent": 53,
"children": [],
"visible": true,
"components": [
@@ -997,11 +2640,12 @@
]
},
{
- "id": 22,
+ "id": 55,
"name": "Bone1",
- "parent": 20,
+ "parent": 53,
"children": [
- 24
+ 57,
+ 57
],
"visible": true,
"components": [
@@ -1018,9 +2662,9 @@
]
},
{
- "id": 23,
+ "id": 56,
"name": "EnemyBody",
- "parent": 20,
+ "parent": 53,
"children": [],
"visible": true,
"components": [
@@ -1060,9 +2704,9 @@
]
},
{
- "id": 24,
+ "id": 57,
"name": "EnemyHitAnchor",
- "parent": 22,
+ "parent": 55,
"children": [],
"visible": true,
"components": [
@@ -1079,7 +2723,7 @@
]
},
{
- "id": 25,
+ "id": 58,
"name": "NavVolume",
"parent": null,
"children": [],
@@ -1090,8 +2734,8 @@
"data": {
"position": {
"x": 0,
- "y": 125,
- "z": -300
+ "y": 60,
+ "z": -3150
}
}
},
@@ -1099,9 +2743,9 @@
"type": "NavVolume",
"data": {
"halfExtents": {
- "x": 900,
+ "x": 700,
"y": 220,
- "z": 900
+ "z": 450
},
"cellSize": 25,
"cellHeight": 10,
@@ -3213,4 +4857,4 @@
]
}
]
-}
+}
\ No newline at end of file
diff --git a/examples/third-person-3d/src/components.ts b/examples/third-person-3d/src/components.ts
new file mode 100644
index 000000000..70112be48
--- /dev/null
+++ b/examples/third-person-3d/src/components.ts
@@ -0,0 +1,41 @@
+import { defineComponent, defineTag } from 'esengine';
+
+/** The one the player is. Marks whose health and position the run tracks. */
+export const Runner = defineTag('Runner');
+
+/** A shard the archive wants back. Three of them open the gate. */
+export const Core = defineComponent('Core', {
+ taken: false,
+ /** Radians of spin, so a taken core can stop turning. */
+ spin: 0,
+});
+
+/** The door the run ends at. */
+export const Gate = defineComponent('Gate', {
+ open: false,
+});
+
+/** Something E does something to, once the runner is close enough. */
+export const Reachable = defineComponent('Reachable', {
+ radius: 120,
+ prompt: '',
+});
+
+/** A floor that costs health to stand on. Axis-aligned about its own origin. */
+export const Hazard = defineComponent('Hazard', {
+ halfX: 100,
+ halfZ: 100,
+ damagePerSecond: 30,
+});
+
+/** Where a death puts the runner back. Armed once it is walked past. */
+export const Checkpoint = defineComponent('Checkpoint', {
+ /** Z the runner must reach for this to become the one it returns to. */
+ armZ: 0,
+ reached: false,
+});
+
+export const HealthMeter = defineTag('HealthMeter');
+export const ObjectiveText = defineTag('ObjectiveText');
+export const PromptText = defineTag('PromptText');
+export const OverlayText = defineTag('OverlayText');
diff --git a/examples/third-person-3d/src/main.ts b/examples/third-person-3d/src/main.ts
index caa75722a..145ac5b56 100644
--- a/examples/third-person-3d/src/main.ts
+++ b/examples/third-person-3d/src/main.ts
@@ -46,3 +46,23 @@ const hitSparkSystem = defineSystem(
addSystemToSchedule(Schedule.Update, footstepDustSystem);
addSystemToSchedule(Schedule.Update, hitSparkSystem);
+
+
+import './components';
+import { runInputSystem, sprintSystem, progressSystem } from './systems/run';
+import { coreBobSystem, hazardSystem, interactSystem } from './systems/world';
+import { lifecycleSystem } from './systems/lifecycle';
+import { hudSystem, openingSystem } from './systems/hud';
+
+// Order is the frame's argument: input becomes edges, the world reacts to them,
+// the lifecycle decides what state that leaves the run in, and only then is the
+// player told. A HUD read before the lifecycle would show the frame before.
+addSystemToSchedule(Schedule.Update, runInputSystem);
+addSystemToSchedule(Schedule.Update, sprintSystem);
+addSystemToSchedule(Schedule.Update, progressSystem);
+addSystemToSchedule(Schedule.Update, coreBobSystem);
+addSystemToSchedule(Schedule.Update, hazardSystem);
+addSystemToSchedule(Schedule.Update, interactSystem);
+addSystemToSchedule(Schedule.Update, lifecycleSystem);
+addSystemToSchedule(Schedule.Update, hudSystem);
+addSystemToSchedule(Schedule.Update, openingSystem);
diff --git a/examples/third-person-3d/src/resources.ts b/examples/third-person-3d/src/resources.ts
new file mode 100644
index 000000000..da2a0d8cd
--- /dev/null
+++ b/examples/third-person-3d/src/resources.ts
@@ -0,0 +1,40 @@
+import { defineResource } from 'esengine';
+
+/** Where the runner starts, and where a restart puts it back. */
+export const SPAWN = { x: 0, y: 60, z: 120 };
+/** Below this there is no floor left to land on. */
+export const VOID_Y = -400;
+
+export const MAX_HEALTH = 100;
+export const CORES_NEEDED = 3;
+/** What holding shift costs in control: it is speed, not a second gear. */
+export const SPRINT_SPEED = 520;
+export const WALK_SPEED = 320;
+
+export type RunPhase = 'playing' | 'paused' | 'dead' | 'won';
+
+export interface RunData {
+ phase: RunPhase;
+ cores: number;
+ /** Seconds of play, paused time excluded. */
+ elapsed: number;
+ /** Where the next death returns the runner to. */
+ respawn: { x: number; y: number; z: number };
+ /** What the runner may press E on this frame, and what that would do. */
+ prompt: string;
+ /** Set by input, consumed by the lifecycle: one edge per press. */
+ restartPressed: boolean;
+ pausePressed: boolean;
+ interactPressed: boolean;
+}
+
+export const Run = defineResource<RunData>({
+ phase: 'playing',
+ cores: 0,
+ elapsed: 0,
+ respawn: { ...SPAWN },
+ prompt: '',
+ restartPressed: false,
+ pausePressed: false,
+ interactPressed: false,
+}, 'Run');
diff --git a/examples/third-person-3d/src/systems/hud.ts b/examples/third-person-3d/src/systems/hud.ts
new file mode 100644
index 000000000..b109c68a9
--- /dev/null
+++ b/examples/third-person-3d/src/systems/hud.ts
@@ -0,0 +1,62 @@
+import {
+ defineSystem, Res, Query, Mut,
+ Text, UIVisual, Health,
+} from 'esengine';
+import { Runner, HealthMeter, ObjectiveText, PromptText, OverlayText } from '../components';
+import { Run, MAX_HEALTH, CORES_NEEDED, type RunData } from '../resources';
+
+const clock = (seconds: number): string => {
+ const s = Math.max(0, Math.floor(seconds));
+ return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, '0')}`;
+};
+
+/**
+ * Everything the player is told, in one pass. Four lines and a bar: what is
+ * left of them, what they are here for, what this key would do, and — only when
+ * the run has stopped — why and how to go on.
+ */
+export const hudSystem = defineSystem(
+ [
+ Res(Run),
+ Query(Health, Runner),
+ Query(Mut(UIVisual), HealthMeter),
+ Query(Mut(Text), ObjectiveText),
+ Query(Mut(Text), PromptText),
+ Query(Mut(Text), OverlayText),
+ ],
+ (run: RunData, runners, meters, objectives, prompts, overlays) => {
+ let health = 0;
+ for (const [, hp] of runners) health = hp.current;
+ for (const [, fill] of meters) {
+ fill.fillAmount = Math.max(0, Math.min(1, health / MAX_HEALTH));
+ }
+ for (const [, text] of objectives) {
+ text.content = run.cores >= CORES_NEEDED
+ ? `cores ${run.cores}/${CORES_NEEDED} — the gate will open now ${clock(run.elapsed)}`
+ : `cores ${run.cores}/${CORES_NEEDED} ${clock(run.elapsed)}`;
+ }
+ for (const [, text] of prompts) {
+ text.content = run.phase === 'playing' ? run.prompt : '';
+ }
+ for (const [, text] of overlays) {
+ text.content =
+ run.phase === 'paused' ? 'PAUSED\n\nEsc — continue R — start over'
+ : run.phase === 'dead' ? 'YOU FELL\n\nE — from the last marker R — start over'
+ : run.phase === 'won' ? `THE ARCHIVE OPENS\n\n${clock(run.elapsed)}\n\nR — again`
+ : '';
+ }
+ },
+ { name: 'HudSystem' },
+);
+
+/** The opening line, replaced by the first real objective the moment one exists. */
+export const openingSystem = defineSystem(
+ [Res(Run), Query(Mut(Text), ObjectiveText)],
+ (run: RunData, objectives) => {
+ if (run.elapsed > 6 || run.phase !== 'playing') return;
+ for (const [, text] of objectives) {
+ text.content = 'WASD to walk · mouse to look · Shift to run · Space to jump';
+ }
+ },
+ { name: 'OpeningSystem' },
+);
diff --git a/examples/third-person-3d/src/systems/lifecycle.ts b/examples/third-person-3d/src/systems/lifecycle.ts
new file mode 100644
index 000000000..3b9ac6732
--- /dev/null
+++ b/examples/third-person-3d/src/systems/lifecycle.ts
@@ -0,0 +1,89 @@
+import {
+ defineSystem, Res, ResMut, Query, Mut, GetWorld,
+ Time, Transform, MeshRenderer, CharacterController3D, Health,
+ type World, type Entity, type TimeData, type HealthData,
+} from 'esengine';
+import { Physics3D, type Physics3DQueries } from 'esengine/physics3d';
+import { Runner, Core, Gate, Checkpoint } from '../components';
+import { Run, SPAWN, VOID_Y, MAX_HEALTH, type RunData } from '../resources';
+
+/**
+ * Put the runner somewhere. A character's position is physics OUTPUT — the step
+ * writes it into Transform every frame — so assigning the Transform here would
+ * be overwritten before it was drawn. `teleportCharacter` is the way to say it.
+ */
+function place(world: World, queries: Physics3DQueries | null,
+ runner: Entity, to: { x: number; y: number; z: number }): void {
+ queries?.teleportCharacter(runner, to);
+ world.update(runner, CharacterController3D, (c) => {
+ c.velocity.x = 0; c.velocity.y = 0; c.velocity.z = 0;
+ });
+}
+
+/**
+ * The four states a run is ever in, and the two ways out of each. Pause stops
+ * time itself rather than the systems that read it: a paused world whose physics
+ * kept stepping would drift under a menu nobody is touching.
+ */
+export const lifecycleSystem = defineSystem(
+ [
+ GetWorld(), ResMut(Run), ResMut(Time), Res(Physics3D),
+ Query(Transform, Mut(Health), Runner),
+ Query(Mut(Core), Mut(MeshRenderer)),
+ Query(Mut(Gate), Mut(MeshRenderer)),
+ Query(Mut(Checkpoint)),
+ ],
+ (world, runMut, timeMut, queries, runners, cores, gates, checkpoints) => {
+ const run = runMut.get() as RunData;
+ const time = timeMut.get() as TimeData;
+
+ let runner: Entity | null = null;
+ let at: { x: number; y: number; z: number } | null = null;
+ let health: HealthData | null = null;
+ for (const [entity, transform, hp] of runners) {
+ runner = entity; at = transform.position; health = hp;
+ }
+
+ // Restart is available from every state, including the two that end it.
+ if (run.restartPressed) {
+ run.phase = 'playing';
+ if (health) health.current = MAX_HEALTH;
+ run.cores = 0;
+ run.elapsed = 0;
+ run.respawn = { ...SPAWN };
+ for (const [, core, mesh] of cores) { core.taken = false; mesh.enabled = true; }
+ for (const [, gate, mesh] of gates) { gate.open = false; mesh.enabled = true; }
+ for (const [, point] of checkpoints) point.reached = false;
+ if (runner !== null) place(world, queries, runner, SPAWN);
+ time.scale = 1;
+ return;
+ }
+
+ if (run.phase === 'playing') {
+ if (run.pausePressed) { run.phase = 'paused'; time.scale = 0; return; }
+ const drowned = at !== null && at.y < VOID_Y;
+ if ((health !== null && health.current <= 0) || drowned) {
+ run.phase = 'dead';
+ if (health) health.current = 0;
+ time.scale = 0;
+ }
+ return;
+ }
+
+ if (run.phase === 'paused') {
+ if (run.pausePressed) { run.phase = 'playing'; time.scale = 1; }
+ return;
+ }
+
+ if (run.phase === 'dead') {
+ // Space, not R: the run continues from the last checkpoint, and the
+ // cores already taken stay taken. R is the whole level again.
+ if (!run.interactPressed) return;
+ run.phase = 'playing';
+ if (health) health.current = MAX_HEALTH;
+ if (runner !== null) place(world, queries, runner, run.respawn);
+ time.scale = 1;
+ }
+ },
+ { name: 'LifecycleSystem' },
+);
diff --git a/examples/third-person-3d/src/systems/run.ts b/examples/third-person-3d/src/systems/run.ts
new file mode 100644
index 000000000..3b992d5e9
--- /dev/null
+++ b/examples/third-person-3d/src/systems/run.ts
@@ -0,0 +1,64 @@
+import {
+ defineSystem, Res, ResMut, Query, Mut,
+ Input, Time, Transform, ThirdPersonController,
+ type InputState, type TimeData,
+} from 'esengine';
+import { Runner, Checkpoint } from '../components';
+import { Run, SPRINT_SPEED, WALK_SPEED, type RunData } from '../resources';
+
+/**
+ * The three keys the run itself listens for, taken as EDGES. A phase change
+ * driven by `isKeyDown` fires every frame the key is held, which turns one
+ * press of Escape into pause/unpause/pause for as long as a finger rests.
+ */
+export const runInputSystem = defineSystem(
+ [Res(Input), ResMut(Run)],
+ (input: InputState, runMut) => {
+ const run = runMut.get() as RunData;
+ run.pausePressed = input.isKeyPressed('Escape');
+ run.restartPressed = input.isKeyPressed('KeyR');
+ run.interactPressed = input.isKeyPressed('KeyE');
+ },
+ { name: 'RunInputSystem' },
+);
+
+/**
+ * Sprint is a speed, not a gear: the controller already accelerates toward
+ * whatever top speed it is given, so holding shift raises the target and
+ * releasing it lets the same deceleration bring the character back down.
+ */
+export const sprintSystem = defineSystem(
+ [Res(Input), Res(Run), Query(Mut(ThirdPersonController), Runner)],
+ (input: InputState, run: RunData, runners) => {
+ const wanted = run.phase === 'playing'
+ && (input.isKeyDown('ShiftLeft') || input.isKeyDown('ShiftRight'))
+ ? SPRINT_SPEED : WALK_SPEED;
+ for (const [, controller] of runners) {
+ controller.moveSpeed = wanted;
+ // A paused or dead runner is not steering. The controller is the one
+ // thing that reads the stick, so switching it off is the whole stop.
+ controller.enabled = run.phase === 'playing';
+ }
+ },
+ { name: 'SprintSystem' },
+);
+
+/** Play time, and the last checkpoint walked past. */
+export const progressSystem = defineSystem(
+ [Res(Time), ResMut(Run), Query(Transform, Runner), Query(Mut(Checkpoint), Transform)],
+ (time: TimeData, runMut, runners, checkpoints) => {
+ const run = runMut.get() as RunData;
+ if (run.phase !== 'playing') return;
+ run.elapsed += time.delta;
+
+ for (const [, transform] of runners) {
+ const z = transform.position.z;
+ for (const [, point, at] of checkpoints) {
+ if (point.reached || z > point.armZ) continue;
+ point.reached = true;
+ run.respawn = { x: at.position.x, y: at.position.y, z: at.position.z };
+ }
+ }
+ },
+ { name: 'ProgressSystem' },
+);
diff --git a/examples/third-person-3d/src/systems/world.ts b/examples/third-person-3d/src/systems/world.ts
new file mode 100644
index 000000000..0a4eb17bb
--- /dev/null
+++ b/examples/third-person-3d/src/systems/world.ts
@@ -0,0 +1,101 @@
+import {
+ defineSystem, Res, ResMut, Query, Mut, EventWriter,
+ Time, Transform, MeshRenderer, Damage,
+ type TimeData, type Entity,
+} from 'esengine';
+import { Runner, Hazard, Core, Gate, Reachable } from '../components';
+import { Run, CORES_NEEDED, type RunData } from '../resources';
+
+/** Square distance on the ground plane — height is not what "near" means here. */
+function groundDistance2(a: { x: number; z: number }, b: { x: number; z: number }): number {
+ const dx = a.x - b.x;
+ const dz = a.z - b.z;
+ return dx * dx + dz * dz;
+}
+
+/** A core bobs, so a thing worth walking to reads as one from across the plaza. */
+export const coreBobSystem = defineSystem(
+ [Res(Time), Query(Mut(Core), Mut(Transform))],
+ (time: TimeData, cores) => {
+ for (const [, core, at] of cores) {
+ if (core.taken) continue;
+ core.spin += time.delta * 2;
+ at.position.y += Math.cos(core.spin) * time.delta * 18;
+ }
+ },
+ { name: 'CoreBobSystem' },
+);
+
+/**
+ * Scorched floor: standing on it costs health for as long as you stand there.
+ * Sent as a blow rather than subtracted here — `applyDamage` is the only writer
+ * of `Health`, so a fire and a sword cost the runner the same way.
+ */
+export const hazardSystem = defineSystem(
+ [Res(Time), Res(Run), Query(Transform, Runner), Query(Hazard, Transform), EventWriter(Damage)],
+ (time: TimeData, run: RunData, runners, hazards, damage) => {
+ if (run.phase !== 'playing') return;
+ for (const [runner, at] of runners) {
+ for (const [, zone, origin] of hazards) {
+ if (Math.abs(at.position.x - origin.position.x) > zone.halfX) continue;
+ if (Math.abs(at.position.z - origin.position.z) > zone.halfZ) continue;
+ // Vertical: only the floor you are ON burns, not one two storeys down.
+ if (Math.abs(at.position.y - origin.position.y) > 120) continue;
+ damage.send({
+ target: runner as Entity, source: runner as Entity,
+ amount: zone.damagePerSecond * time.delta,
+ x: at.position.x, y: at.position.y, z: at.position.z,
+ });
+ }
+ }
+ },
+ { name: 'HazardSystem' },
+);
+
+/**
+ * What E would do here, and what it does when pressed. The prompt and the act
+ * are one pass: a prompt computed somewhere else drifts from the thing it
+ * offers the moment either one moves.
+ */
+export const interactSystem = defineSystem(
+ [
+ ResMut(Run), Query(Transform, Runner),
+ Query(Mut(Core), Mut(MeshRenderer), Transform, Reachable),
+ Query(Mut(Gate), Mut(MeshRenderer), Transform, Reachable),
+ ],
+ (runMut, runners, cores, gates) => {
+ const run = runMut.get() as RunData;
+ run.prompt = '';
+ if (run.phase !== 'playing') return;
+
+ let at: { x: number; z: number } | null = null;
+ for (const [, transform] of runners) at = transform.position;
+ if (!at) return;
+
+ for (const [, core, mesh, transform, reach] of cores) {
+ if (core.taken || groundDistance2(at, transform.position) > reach.radius * reach.radius) continue;
+ run.prompt = `E — ${reach.prompt}`;
+ if (!run.interactPressed) continue;
+ core.taken = true;
+ mesh.enabled = false;
+ run.cores += 1;
+ run.interactPressed = false;
+ return;
+ }
+
+ for (const [, gate, mesh, transform, reach] of gates) {
+ if (gate.open || groundDistance2(at, transform.position) > reach.radius * reach.radius) continue;
+ if (run.cores < CORES_NEEDED) {
+ run.prompt = `the gate wants ${CORES_NEEDED - run.cores} more core(s)`;
+ continue;
+ }
+ run.prompt = `E — ${reach.prompt}`;
+ if (!run.interactPressed) continue;
+ gate.open = true;
+ mesh.enabled = false;
+ run.phase = 'won';
+ run.interactPressed = false;
+ }
+ },
+ { name: 'InteractSystem' },
+);
diff --git a/examples/third-person-3d/tsconfig.json b/examples/third-person-3d/tsconfig.json
index 1f11ff310..6fecb89b0 100644
--- a/examples/third-person-3d/tsconfig.json
+++ b/examples/third-person-3d/tsconfig.json
@@ -12,7 +12,8 @@
"rootDir": ".",
"paths": {
"esengine": ["./.esengine/sdk/index.d.ts"],
- "esengine/wasm": ["./.esengine/sdk/wasm.d.ts"]
+ "esengine/wasm": ["./.esengine/sdk/wasm.d.ts"],
+ "esengine/physics3d": ["./.esengine/sdk/physics3d/index.d.ts"]
}
},
"include": ["src/**/*"],
diff --git a/sdk/etc/physics3d.api.md b/sdk/etc/physics3d.api.md
index a8547045b..7e0bd358d 100644
--- a/sdk/etc/physics3d.api.md
+++ b/sdk/etc/physics3d.api.md
@@ -271,7 +271,8 @@ overlapBox: (centre: { x: number; y: number; z: number; }, halfExtents: { x: num
overlapSphere: (centre: { x: number; y: number; z: number; }, radius: number, layerMask?: number) => Overlap3DHit[]
raycast: (origin: { x: number; y: number; z: number; }, direction: { x: number; y: number; z: number; }, layerMask?: number) => Cast3DHit | null
sphereCast: (origin: { x: number; y: number; z: number; }, radius: number, direction: { x: number; y: number; z: number; }, layerMask?: number) => Cast3DHit | null
-static new (module_: Physics3DWasmModule, ppu_: number): Physics3DQueries
+teleportCharacter: (entity: Entity, position: { x: number; y: number; z: number; }) => boolean
+static new (module_: Physics3DWasmModule, ppu_: number, characters_?: ReadonlyMap<Entity, number>): Physics3DQueries
static prototype: Physics3DQueries
```
diff --git a/sdk/src/physics3d/Physics3DModule.ts b/sdk/src/physics3d/Physics3DModule.ts
index 7ce73ea96..ae68a45f9 100644
--- a/sdk/src/physics3d/Physics3DModule.ts
+++ b/sdk/src/physics3d/Physics3DModule.ts
@@ -138,6 +138,7 @@ const REQUIRED_EXPORTS = [
'_physics3d_removeBody', '_physics3d_setTransform', '_physics3d_raycast',
'_physics3d_transforms', '_physics3d_transformsBytes',
'_physics3d_addCharacter', '_physics3d_moveCharacter', '_physics3d_removeCharacter',
+ '_physics3d_setCharacterPosition',
'_physics3d_sphereCast', '_physics3d_overlapSphere', '_physics3d_overlapBox',
'_physics3d_contactEnters', '_physics3d_contactEntersBytes',
'_physics3d_sensorEnters', '_physics3d_sensorEntersBytes',
diff --git a/sdk/src/physics3d/Physics3DPlugin.ts b/sdk/src/physics3d/Physics3DPlugin.ts
index 6b3c49d1b..e606c311b 100644
--- a/sdk/src/physics3d/Physics3DPlugin.ts
+++ b/sdk/src/physics3d/Physics3DPlugin.ts
@@ -76,8 +76,10 @@ export class Physics3DPlugin implements Plugin {
module._physics3d_setLayerMask(layer, mask);
});
runtime.module = module;
- app.insertResource(Physics3D, new Physics3DQueries(module,
- this.config_.pixelsPerUnit));
+ // The character map, not a copy of it: characters are created lazily
+ // by the step, so a snapshot taken here would never hold one.
+ app.insertResource(Physics3D, new Physics3DQueries(
+ module, this.config_.pixelsPerUnit, runtime.characters));
app.addSystemToSchedule(Schedule.FixedUpdate, defineSystem([], () => {
stepPhysics3D(app, module, runtime.bodies, this.config_,
runtime.characters, events, runtime.joints);
diff --git a/sdk/src/physics3d/Physics3DQueries.ts b/sdk/src/physics3d/Physics3DQueries.ts
index 739bbc2c2..f179dfa44 100644
--- a/sdk/src/physics3d/Physics3DQueries.ts
+++ b/sdk/src/physics3d/Physics3DQueries.ts
@@ -40,7 +40,24 @@ export interface Overlap3DHit {
*/
export class Physics3DQueries {
constructor(private readonly module_: Physics3DWasmModule,
- private readonly ppu_: number) {}
+ private readonly ppu_: number,
+ private readonly characters_: ReadonlyMap<Entity, number> = new Map()) {}
+
+ /**
+ * Put a character somewhere, rather than moving it there. Its position is an
+ * OUTPUT — the step writes it into `Transform` every frame — so this is the
+ * only way to say it, and the velocity is dropped with the move.
+ *
+ * Answers false for an entity the world has no character for.
+ */
+ teleportCharacter(entity: Entity, position: { x: number; y: number; z: number }): boolean {
+ const id = this.characters_.get(entity);
+ if (id === undefined) return false;
+ const p = this.ppu_;
+ this.module_._physics3d_setCharacterPosition(
+ id, position.x / p, position.y / p, position.z / p);
+ return true;
+ }
/** The nearest body along a ray, or null. `direction` carries its length. */
raycast(origin: { x: number; y: number; z: number },
diff --git a/src/esengine/bindings/modules/physics3d/Physics3DModuleEntry.cpp b/src/esengine/bindings/modules/physics3d/Physics3DModuleEntry.cpp
index 5c35a6722..d019b41d9 100644
--- a/src/esengine/bindings/modules/physics3d/Physics3DModuleEntry.cpp
+++ b/src/esengine/bindings/modules/physics3d/Physics3DModuleEntry.cpp
@@ -564,10 +564,19 @@ void physics3d_moveCharacter(uint32_t characterId, float vx, float vy, float vz,
};
}
+/**
+ * @brief Puts a character somewhere, rather than moving it there.
+ * @details The velocity goes with it. A CharacterVirtual carries its own
+ * vertical speed between steps, so a character teleported mid-fall
+ * would arrive still falling and drive itself through the floor it
+ * was placed on.
+ */
EMSCRIPTEN_KEEPALIVE
void physics3d_setCharacterPosition(uint32_t characterId, float px, float py, float pz) {
auto found = g().characters.find(characterId);
- if (found != g().characters.end()) found->second->SetPosition(RVec3(px, py, pz));
+ if (found == g().characters.end()) return;
+ found->second->SetPosition(RVec3(px, py, pz));
+ found->second->SetLinearVelocity(Vec3::sZero());
}
// Queries
diff --git a/templates/3d-starter/tsconfig.json b/templates/3d-starter/tsconfig.json
index 1f11ff310..6fecb89b0 100644
--- a/templates/3d-starter/tsconfig.json
+++ b/templates/3d-starter/tsconfig.json
@@ -12,7 +12,8 @@
"rootDir": ".",
"paths": {
"esengine": ["./.esengine/sdk/index.d.ts"],
- "esengine/wasm": ["./.esengine/sdk/wasm.d.ts"]
+ "esengine/wasm": ["./.esengine/sdk/wasm.d.ts"],
+ "esengine/physics3d": ["./.esengine/sdk/physics3d/index.d.ts"]
}
},
"include": ["src/**/*"],