@origingame/engine 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/bin/og.mjs +25 -0
  2. package/dist/web/origin-engine.d.ts +1233 -0
  3. package/dist/web/origin-engine.js +8628 -0
  4. package/dist/web/origin-engine_bg.wasm +0 -0
  5. package/dist/web/origin-engine_bg.wasm.d.ts +366 -0
  6. package/dist/web-publish/origin-engine-lanes.js +8509 -0
  7. package/dist/web-publish/origin-engine-lanes_bg.wasm +0 -0
  8. package/dist/web-publish/origin-engine.d.ts +1176 -0
  9. package/dist/web-publish/origin-engine.js +8313 -0
  10. package/dist/web-publish/origin-engine_bg.wasm +0 -0
  11. package/dist/web-publish/origin-engine_bg.wasm.d.ts +347 -0
  12. package/dist/web-publish/snippets/wasm-bindgen-rayon-38edf6e439f6d70d/src/workerHelpers.no-bundler.js +77 -0
  13. package/dist/web-publish-2d/origin-engine-lanes.js +8509 -0
  14. package/dist/web-publish-2d/origin-engine-lanes_bg.wasm +0 -0
  15. package/dist/web-publish-2d/origin-engine.d.ts +1176 -0
  16. package/dist/web-publish-2d/origin-engine.js +8313 -0
  17. package/dist/web-publish-2d/origin-engine_bg.wasm +0 -0
  18. package/dist/web-publish-2d/origin-engine_bg.wasm.d.ts +347 -0
  19. package/dist/web-publish-2d/snippets/wasm-bindgen-rayon-38edf6e439f6d70d/src/workerHelpers.no-bundler.js +77 -0
  20. package/knowledge/README.md +31 -0
  21. package/knowledge/knowledge.json +13 -0
  22. package/knowledge/looks/catalogue.json +1871 -0
  23. package/knowledge/package.json +33 -0
  24. package/knowledge/rules/platform.json +329 -0
  25. package/knowledge/scaffold/README.md +27 -0
  26. package/knowledge/scaffold/distribution.json +48 -0
  27. package/knowledge/scaffold/origin-engine.json +19 -0
  28. package/knowledge/scaffold/template/.origin/setup +14 -0
  29. package/knowledge/scaffold/template/LICENSES.md +23 -0
  30. package/knowledge/scaffold/template/README.md +37 -0
  31. package/knowledge/scaffold/template/assets/ai/guard.ogt +48 -0
  32. package/knowledge/scaffold/template/assets/audio/click.ogt +9 -0
  33. package/knowledge/scaffold/template/assets/fonts/NotoSansSC-Regular-subset.ttf.ogt +12 -0
  34. package/knowledge/scaffold/template/assets/fonts/OFL.txt +93 -0
  35. package/knowledge/scaffold/template/assets/looks/origin-game.ogt +12 -0
  36. package/knowledge/scaffold/template/assets/nav/yard.ogt +27 -0
  37. package/knowledge/scaffold/template/assets/scenes/main.ogt +34 -0
  38. package/knowledge/scaffold/template/assets/strings/en.ogt +14 -0
  39. package/knowledge/scaffold/template/assets/textures/stone_n.png.ogt +7 -0
  40. package/knowledge/scaffold/template/gitattributes +22 -0
  41. package/knowledge/scaffold/template/package.json +18 -0
  42. package/knowledge/scaffold/template/project.ogt +25 -0
  43. package/knowledge/scaffold/template/src/main.ts +246 -0
  44. package/knowledge/scaffold/template/tests/guard.og.ts +67 -0
  45. package/knowledge/scaffold/template/tests/smoke.og.ts +43 -0
  46. package/knowledge/scaffold/template/tsconfig.json +17 -0
  47. package/knowledge/scripts/lib.ts +203 -0
  48. package/knowledge/scripts/mount.ts +210 -0
  49. package/knowledge/scripts/pack.ts +24 -0
  50. package/knowledge/scripts/scaffold.ts +72 -0
  51. package/knowledge/scripts/validate.ts +749 -0
  52. package/knowledge/skills/og-ai/SKILL.md +386 -0
  53. package/knowledge/skills/og-audio/SKILL.md +191 -0
  54. package/knowledge/skills/og-build/SKILL.md +330 -0
  55. package/knowledge/skills/og-core/SKILL.md +285 -0
  56. package/knowledge/skills/og-feel/SKILL.md +385 -0
  57. package/knowledge/skills/og-game/SKILL.md +1479 -0
  58. package/knowledge/skills/og-i18n/SKILL.md +220 -0
  59. package/knowledge/skills/og-platform-sdk/SKILL.md +199 -0
  60. package/knowledge/skills/og-taste/SKILL.md +537 -0
  61. package/knowledge/skills/og-ui/SKILL.md +444 -0
  62. package/knowledge/wiki/ai.md +627 -0
  63. package/knowledge/wiki/anim.md +1187 -0
  64. package/knowledge/wiki/atmosphere.md +636 -0
  65. package/knowledge/wiki/audio.md +732 -0
  66. package/knowledge/wiki/camera.md +711 -0
  67. package/knowledge/wiki/commands.md +357 -0
  68. package/knowledge/wiki/game.md +220 -0
  69. package/knowledge/wiki/i18n.md +213 -0
  70. package/knowledge/wiki/index.md +1027 -0
  71. package/knowledge/wiki/input.md +1714 -0
  72. package/knowledge/wiki/load.md +1280 -0
  73. package/knowledge/wiki/math.md +166 -0
  74. package/knowledge/wiki/nav.md +1154 -0
  75. package/knowledge/wiki/physics.md +3142 -0
  76. package/knowledge/wiki/platform.md +857 -0
  77. package/knowledge/wiki/probe.md +1692 -0
  78. package/knowledge/wiki/reflect.md +285 -0
  79. package/knowledge/wiki/render.md +3511 -0
  80. package/knowledge/wiki/rng.md +393 -0
  81. package/knowledge/wiki/stream.md +376 -0
  82. package/knowledge/wiki/system.md +197 -0
  83. package/knowledge/wiki/systems.md +43 -0
  84. package/knowledge/wiki/terrain.md +727 -0
  85. package/knowledge/wiki/tilemap.md +422 -0
  86. package/knowledge/wiki/time.md +150 -0
  87. package/knowledge/wiki/transform.md +230 -0
  88. package/knowledge/wiki/tween.md +580 -0
  89. package/knowledge/wiki/ui.md +8000 -0
  90. package/knowledge/wiki/world.md +909 -0
  91. package/package.json +68 -4
  92. package/schema/api.schema.json +29675 -0
  93. package/shell/README.md +22 -0
  94. package/shell/brand/README.md +23 -0
  95. package/shell/brand/icon-192.png +0 -0
  96. package/shell/brand/icon-512.png +0 -0
  97. package/shell/brand/mark-on-paper.svg +6 -0
  98. package/shell/brand/origin-mark.svg +5 -0
  99. package/shell/brand/origin-motion.css +251 -0
  100. package/shell/brand/tokens.css +20 -0
  101. package/shell/brand.ts +132 -0
  102. package/shell/page.ts +715 -0
  103. package/shell/platform.ts +203 -0
  104. package/shell/player.ts +238 -0
  105. package/shell/shell.css +185 -0
  106. package/shell/sw.ts +177 -0
  107. package/shell/transport.ts +515 -0
  108. package/shell/wire.ts +369 -0
  109. package/src/e6.ts +69 -0
  110. package/src/env.d.ts +100 -0
  111. package/src/generated/abi.ts +980 -0
  112. package/src/index.ts +193 -0
  113. package/src/node/audio.ts +86 -0
  114. package/src/node/build.ts +109 -0
  115. package/src/node/device.ts +981 -0
  116. package/src/node/doctor.ts +60 -0
  117. package/src/node/index.ts +102 -0
  118. package/src/node/platform.ts +24 -0
  119. package/src/node/playtest-run.ts +249 -0
  120. package/src/node/png.ts +130 -0
  121. package/src/node/polish.ts +976 -0
  122. package/src/node/run.ts +373 -0
  123. package/src/node/web-build.ts +808 -0
  124. package/src/p2.ts +35 -0
  125. package/src/platform-local.ts +211 -0
  126. package/src/playtest.ts +131 -0
  127. package/src/runtime.ts +1509 -0
  128. package/src/systems/cameras.ts +247 -0
  129. package/src/ui-kit/bind.ts +141 -0
  130. package/src/ui-kit/huds.ts +303 -0
  131. package/src/ui-kit/index.ts +36 -0
  132. package/src/ui-kit/menus.ts +187 -0
  133. package/src/ui-kit/settings.ts +131 -0
  134. package/src/ui-kit/store.ts +222 -0
  135. package/src/ui-kit/story.ts +89 -0
  136. package/src/ui-kit/util.ts +106 -0
  137. package/src/web/a11y.ts +429 -0
  138. package/src/web/audio-worklet.ts +193 -0
  139. package/src/web/audio.ts +307 -0
  140. package/src/web/basis.ts +239 -0
  141. package/src/web/gamepad.ts +123 -0
  142. package/src/web/host.ts +166 -0
  143. package/src/web/input.ts +237 -0
  144. package/src/web/lanes.ts +21 -0
  145. package/src/web/play.ts +20 -0
  146. package/src/web/rpc-ring.ts +110 -0
  147. package/src/web/settle.ts +122 -0
  148. package/src/web/shell.ts +643 -0
  149. package/src/web/text-input.ts +248 -0
  150. package/src/web/worker.ts +1002 -0
  151. package/types/bindings.json +13654 -0
  152. package/types/index.d.ts +20090 -0
  153. package/vendor/basis/LICENSE +201 -0
  154. package/vendor/basis/NOTICE +15 -0
  155. package/vendor/basis/README.md +18 -0
  156. package/vendor/basis/basis_transcoder.js +19 -0
  157. package/vendor/basis/basis_transcoder.wasm +0 -0
  158. package/README.md +0 -3
@@ -0,0 +1,711 @@
1
+ <!-- Generated from crates/og-api/api.ogt by `og api gen`. Do not edit: `og api check` fails on any difference; change api.ogt and regenerate. -->
2
+
3
+ # The `camera` module
4
+
5
+ The main camera, as a resource with three.js PerspectiveCamera and OrthographicCamera parameter names.
6
+
7
+ Camera controllers are components (OrbitCamera, FollowCamera, Follow2D) on the entity the camera orbits or follows; the systems that drive them ship in TypeScript as og.systems.cameras.
8
+
9
+ - **TypeScript**: functions are the namespace `og.camera`; components, resources and events are tokens on `og`.
10
+ - **Publish builds**: kept (members may override).
11
+ - **Skill**: `og-feel`, which teaches the module (how much of it to use, and how to prove it).
12
+ - **Index**: [every module and name](index.md).
13
+
14
+ ```ogt
15
+ module camera {
16
+ # declarations follow, each quoted below
17
+ ```
18
+
19
+ <sub>`api.ogt` line 1288</sub>
20
+
21
+ ## Contents
22
+
23
+ | Name | Kind | Summary |
24
+ |---|---|---|
25
+ | [`og.Camera`](#record-Camera) | resource | The camera the frame is rendered from. Rendering reads it after the tick; it never feeds back into the simulation. |
26
+ | [`og.OrbitCamera`](#record-OrbitCamera) | component | Orbits og.Camera around the entity carrying it, as three.js OrbitControls: a left-button drag on the play surface turns it, the wheel zooms, autoRotate turns it on its own. |
27
+ | [`og.FollowCamera`](#record-FollowCamera) | component | Chases the entity carrying it with og.Camera: a third-person 3D view that eases towards a point offset from the entity and looks at it. Driven by og.systems.cameras; the first entity carrying one, in query order, drives the camera. |
28
+ | [`og.Follow2D`](#record-Follow2D) | component | Keeps og.Camera on the entity carrying it in the xy plane, for 2D games: the camera moves only when the entity leaves the dead zone, eases by smoothTime (smoothTimeY for y when set) and, with clamp, stays inside the bounds; lookAhead leads it in the direction the entity moves. The camera keeps its z, rotation and projection. Driven by og.systems.cameras; og.CameraZone entities then keep the view inside the zone the entity is in. |
29
+ | [`og.CameraZone`](#record-CameraZone) | component | A rectangle of the xy plane (min to max, world units, not moved by the entity's Transform) that keeps a 2D view inside it while the entity followed by og.Follow2D is in it: rooms, arenas, a level's bounds. Of overlapping zones the highest priority wins, then the first in query order. The engine's og.camera system picks the zone after the game's systems (into og.Camera's zone fields); entering another zone scrolls the view across over the new zone's scrollTime, or jumps when it is 0. A zone smaller than the view centres it. |
30
+ | [`og.CameraRail`](#record-CameraRail) | component | Moves og.Camera along a spline through p0 to p(points - 1) (Catmull-Rom, through every point) to the point nearest the entity carrying it, easing by smoothTime: a corridor, a side-scroller's track, a 3D chase on rails. A perspective camera looks at the entity; an orthographic one keeps its z and rotation. Applied by the engine's og.camera system after the game's systems. |
31
+ | [`og.camera.shake`](#fn-shake) | function | Add screen shake: trauma, clamped to 1, which og.Camera decays by traumaDecay. The shake grows with trauma squared, so 0.1-0.2 is a light hit, 0.25-0.4 a medium one, 0.5-0.8 an explosion or a boss slam; 1 is almost never right (nauseating). Visual only. Systems may call it; it takes effect at the engine's og.camera system this tick. |
32
+ | [`og.camera.punch`](#fn-punch) | function | A zoom punch: the view narrows by `amount` (0.05 is a tap, 0.15 a slam) and springs back by Camera.punchDecay. Visual only. |
33
+ | [`og.camera.kick`](#fn-kick) | function | A directional nudge of the view (recoil, an impact from one side): offset by `distance` along `direction`, returning by Camera.kickDecay. Visual only. |
34
+
35
+ ## Functions
36
+
37
+ <a id="fn-shake"></a>
38
+
39
+ ### `og.camera.shake`
40
+
41
+ Add screen shake: trauma, clamped to 1, which og.Camera decays by traumaDecay. The shake grows with trauma squared, so 0.1-0.2 is a light hit, 0.25-0.4 a medium one, 0.5-0.8 an explosion or a boss slam; 1 is almost never right (nauseating). Visual only. Systems may call it; it takes effect at the engine's og.camera system this tick.
42
+
43
+ ```ts
44
+ og.camera.shake(world: World, trauma: number): Result<void>
45
+ ```
46
+
47
+ | Parameter | Type | Optional | Doc |
48
+ |---|---|---|---|
49
+ | `world` | `World` | no | The world. |
50
+ | `trauma` | `number` | no | Trauma to add, 0 to 1. |
51
+
52
+ **Returns** `Result<void>`.
53
+
54
+ Binding symbol `og_camera_shake` · publish builds: kept
55
+
56
+ ```ogt
57
+ fn shake {
58
+ doc "Add screen shake: trauma, clamped to 1, which og.Camera decays by traumaDecay. The shake grows with trauma squared, so 0.1-0.2 is a light hit, 0.25-0.4 a medium one, 0.5-0.8 an explosion or a boss slam; 1 is almost never right (nauseating). Visual only. Systems may call it; it takes effect at the engine's og.camera system this tick."
59
+ param world World "The world."
60
+ param trauma f32 "Trauma to add, 0 to 1."
61
+ returns Result.Void
62
+ }
63
+ ```
64
+
65
+ <sub>`api.ogt` line 1624</sub>
66
+
67
+ <a id="fn-punch"></a>
68
+
69
+ ### `og.camera.punch`
70
+
71
+ A zoom punch: the view narrows by `amount` (0.05 is a tap, 0.15 a slam) and springs back by Camera.punchDecay. Visual only.
72
+
73
+ ```ts
74
+ og.camera.punch(world: World, amount: number): Result<void>
75
+ ```
76
+
77
+ | Parameter | Type | Optional | Doc |
78
+ |---|---|---|---|
79
+ | `world` | `World` | no | The world. |
80
+ | `amount` | `number` | no | The fraction to zoom in (negative zooms out), -0.9 to 4. |
81
+
82
+ **Returns** `Result<void>`.
83
+
84
+ Binding symbol `og_camera_punch` · publish builds: kept
85
+
86
+ ```ogt
87
+ fn punch {
88
+ doc "A zoom punch: the view narrows by `amount` (0.05 is a tap, 0.15 a slam) and springs back by Camera.punchDecay. Visual only."
89
+ param world World "The world."
90
+ param amount f32 "The fraction to zoom in (negative zooms out), -0.9 to 4."
91
+ returns Result.Void
92
+ }
93
+ ```
94
+
95
+ <sub>`api.ogt` line 1631</sub>
96
+
97
+ <a id="fn-kick"></a>
98
+
99
+ ### `og.camera.kick`
100
+
101
+ A directional nudge of the view (recoil, an impact from one side): offset by `distance` along `direction`, returning by Camera.kickDecay. Visual only.
102
+
103
+ ```ts
104
+ og.camera.kick(world: World, direction: Vector3, distance: number): Result<void>
105
+ ```
106
+
107
+ | Parameter | Type | Optional | Doc |
108
+ |---|---|---|---|
109
+ | `world` | `World` | no | The world. |
110
+ | `direction` | `Vector3` | no | The direction to push the view (normalised here; zero does nothing). |
111
+ | `distance` | `number` | no | How far, in world units. |
112
+
113
+ **Returns** `Result<void>`.
114
+
115
+ Binding symbol `og_camera_kick` · publish builds: kept
116
+
117
+ ```ogt
118
+ fn kick {
119
+ doc "A directional nudge of the view (recoil, an impact from one side): offset by `distance` along `direction`, returning by Camera.kickDecay. Visual only."
120
+ param world World "The world."
121
+ param direction Vector3 "The direction to push the view (normalised here; zero does nothing)."
122
+ param distance f32 "How far, in world units."
123
+ returns Result.Void
124
+ }
125
+ ```
126
+
127
+ <sub>`api.ogt` line 1638</sub>
128
+
129
+ ## Components, resources and events
130
+
131
+ <a id="record-Camera"></a>
132
+
133
+ ### `og.Camera` (resource)
134
+
135
+ The camera the frame is rendered from. Rendering reads it after the tick; it never feeds back into the simulation.
136
+
137
+ Token `og.Camera`, registered under the schema name `og.Camera`; its value type is `Camera`.
138
+
139
+ | Field | Type | Default | Range | Unit | Notes | Doc |
140
+ |---|---|---|---|---|---|---|
141
+ | `position` | `Vector3` | `{ x: 0, y: 0, z: 0 }` | — | `m` | — | Where the camera is. |
142
+ | `quaternion` | `Quaternion` | `{ x: 0, y: 0, z: 0, w: 1 }` | — | — | — | Its rotation; the camera looks down its local -Z. |
143
+ | `fov` | `number` | `50` | 1 … 179 | `deg` | tunable | The vertical field of view of the perspective projection. |
144
+ | `near` | `number` | `0.1` | ≥ 0.001 | `m` | — | The near clipping plane. |
145
+ | `far` | `number` | `2000` | ≥ 0.01 | `m` | — | The far clipping plane. |
146
+ | `zoom` | `number` | `1` | 0.01 … 100 | — | tunable | The zoom factor, as three.js Camera.zoom. |
147
+ | `orthographic` | `boolean` | `false` | — | — | — | Use an orthographic projection (the 2D profile) instead of a perspective one. |
148
+ | `height` | `number` | `10` | ≥ 0.01 | `m` | — | The visible world height of the orthographic projection. |
149
+ | `background` | `Color` | `{ r: 0.00699, g: 0.00803, b: 0.01096 }` | — | — | — | The clear colour, as three.js Scene.background. The default is the brand ink #14161b in linear RGB. |
150
+ | `exposure` | `number` | `1` | 0 … 16 | — | tunable | Exposure before tone mapping, as three.js toneMappingExposure. |
151
+ | `trauma` | `number` | `0` | 0 … 1 | — | tunable | Screen shake, 0 to 1, added by og.camera.shake and decayed by traumaDecay every tick (unscaled, so a hit stop still shakes). The offset and roll grow with trauma squared and follow smooth noise of the tick: visual only, a replay shakes the same. |
152
+ | `traumaDecay` | `number` | `1.5` | ≥ 0 | `perSecond` | tunable | How much trauma drains per second. |
153
+ | `shakeOffset` | `number` | `0.04` | ≥ 0 | — | tunable | The largest offset at trauma 1, as a fraction of the view height. |
154
+ | `shakeRoll` | `number` | `2` | ≥ 0 | `deg` | tunable | The largest roll at trauma 1. |
155
+ | `shakeFrequency` | `number` | `15` | ≥ 0 | `hz` | — | How fast the shake moves. |
156
+ | `punch` | `number` | `0` | -0.9 … 4 | — | — | A zoom punch in progress (og.camera.punch): the view is narrowed by this fraction, decaying by punchDecay. Visual only. |
157
+ | `punchDecay` | `number` | `8` | ≥ 0 | `perSecond` | tunable | How fast a punch springs back (exponential, per second). |
158
+ | `kick` | `Vector3` | `{ x: 0, y: 0, z: 0 }` | — | `m` | — | A kick in progress (og.camera.kick): the view is offset by this, decaying by kickDecay. Visual only. |
159
+ | `kickDecay` | `number` | `12` | ≥ 0 | `perSecond` | tunable | How fast a kick returns (exponential, per second). |
160
+ | `zoneActive` | `boolean` | `false` | — | — | — | The followed entity is in an og.CameraZone: the view keeps inside zoneMin to zoneMax. Written by the og.camera system. |
161
+ | `zoneMin` | `Vector2` | `{ x: 0, y: 0 }` | — | `m` | — | The zone the view keeps inside: its bottom-left corner. |
162
+ | `zoneMax` | `Vector2` | `{ x: 0, y: 0 }` | — | `m` | — | Its top-right corner. |
163
+ | `zoneFromActive` | `boolean` | `false` | — | — | — | A room transition is in progress from the zone zoneFromMin to zoneFromMax: the view scrolls from where that zone kept it to where the new one does. |
164
+ | `zoneFromMin` | `Vector2` | `{ x: 0, y: 0 }` | — | `m` | — | The zone being left: its bottom-left corner. |
165
+ | `zoneFromMax` | `Vector2` | `{ x: 0, y: 0 }` | — | `m` | — | Its top-right corner. |
166
+ | `zoneScroll` | `number` | `1` | 0 … 1 | — | — | How far the transition has come, 0 to 1 (eased; 1 is settled). |
167
+ | `zoneScrollTime` | `number` | `0` | ≥ 0 | `s` | — | How long the transition takes: the entered zone's scrollTime. |
168
+
169
+ ```ogt
170
+ resource Camera {
171
+ doc "The camera the frame is rendered from. Rendering reads it after the tick; it never feeds back into the simulation."
172
+ field position Vector3 "Where the camera is." {
173
+ unit m
174
+ }
175
+ field quaternion Quaternion "Its rotation; the camera looks down its local -Z."
176
+ field fov f32 "The vertical field of view of the perspective projection." {
177
+ default 50
178
+ min 1
179
+ max 179
180
+ unit deg
181
+ tunable true
182
+ }
183
+ field near f32 "The near clipping plane." {
184
+ default 0.1
185
+ min 0.001
186
+ unit m
187
+ }
188
+ field far f32 "The far clipping plane." {
189
+ default 2000
190
+ min 0.01
191
+ unit m
192
+ }
193
+ field zoom f32 "The zoom factor, as three.js Camera.zoom." {
194
+ default 1
195
+ min 0.01
196
+ max 100
197
+ tunable true
198
+ }
199
+ field orthographic bool "Use an orthographic projection (the 2D profile) instead of a perspective one."
200
+ field height f32 "The visible world height of the orthographic projection." {
201
+ default 10
202
+ min 0.01
203
+ unit m
204
+ }
205
+ field background Color "The clear colour, as three.js Scene.background. The default is the brand ink #14161b in linear RGB." {
206
+ default 0.00699 0.00803 0.01096
207
+ }
208
+ field exposure f32 "Exposure before tone mapping, as three.js toneMappingExposure." {
209
+ default 1
210
+ min 0
211
+ max 16
212
+ tunable true
213
+ }
214
+ field trauma f32 "Screen shake, 0 to 1, added by og.camera.shake and decayed by traumaDecay every tick (unscaled, so a hit stop still shakes). The offset and roll grow with trauma squared and follow smooth noise of the tick: visual only, a replay shakes the same." {
215
+ min 0
216
+ max 1
217
+ tunable true
218
+ }
219
+ field traumaDecay f32 "How much trauma drains per second." {
220
+ default 1.5
221
+ min 0
222
+ unit perSecond
223
+ tunable true
224
+ }
225
+ field shakeOffset f32 "The largest offset at trauma 1, as a fraction of the view height." {
226
+ default 0.04
227
+ min 0
228
+ tunable true
229
+ }
230
+ field shakeRoll f32 "The largest roll at trauma 1." {
231
+ default 2
232
+ min 0
233
+ unit deg
234
+ tunable true
235
+ }
236
+ field shakeFrequency f32 "How fast the shake moves." {
237
+ default 15
238
+ min 0
239
+ unit hz
240
+ }
241
+ field punch f32 "A zoom punch in progress (og.camera.punch): the view is narrowed by this fraction, decaying by punchDecay. Visual only." {
242
+ min -0.9
243
+ max 4
244
+ }
245
+ field punchDecay f32 "How fast a punch springs back (exponential, per second)." {
246
+ default 8
247
+ min 0
248
+ unit perSecond
249
+ tunable true
250
+ }
251
+ field kick Vector3 "A kick in progress (og.camera.kick): the view is offset by this, decaying by kickDecay. Visual only." {
252
+ unit m
253
+ }
254
+ field kickDecay f32 "How fast a kick returns (exponential, per second)." {
255
+ default 12
256
+ min 0
257
+ unit perSecond
258
+ tunable true
259
+ }
260
+ field zoneActive bool "The followed entity is in an og.CameraZone: the view keeps inside zoneMin to zoneMax. Written by the og.camera system."
261
+ field zoneMin Vector2 "The zone the view keeps inside: its bottom-left corner." {
262
+ unit m
263
+ }
264
+ field zoneMax Vector2 "Its top-right corner." {
265
+ unit m
266
+ }
267
+ field zoneFromActive bool "A room transition is in progress from the zone zoneFromMin to zoneFromMax: the view scrolls from where that zone kept it to where the new one does."
268
+ field zoneFromMin Vector2 "The zone being left: its bottom-left corner." {
269
+ unit m
270
+ }
271
+ field zoneFromMax Vector2 "Its top-right corner." {
272
+ unit m
273
+ }
274
+ field zoneScroll f32 "How far the transition has come, 0 to 1 (eased; 1 is settled)." {
275
+ default 1
276
+ min 0
277
+ max 1
278
+ }
279
+ field zoneScrollTime f32 "How long the transition takes: the entered zone's scrollTime." {
280
+ unit s
281
+ min 0
282
+ }
283
+ fn lookAt {
284
+ doc "Rotate the camera to look at a point, as three.js Camera.lookAt."
285
+ param target Vector3 "The point to look at."
286
+ }
287
+ fn worldToScreen {
288
+ doc "Where a world point lands on the play surface."
289
+ param point Vector3 "A world point."
290
+ returns Option.Vector2 "CSS pixels, or null behind the camera."
291
+ }
292
+ fn screenToRay {
293
+ doc "The ray through a point of the play surface, for picking."
294
+ param x f32 "Horizontal position in CSS pixels."
295
+ param y f32 "Vertical position in CSS pixels."
296
+ returns Ray
297
+ }
298
+ }
299
+ ```
300
+
301
+ <sub>`api.ogt` line 1293</sub>
302
+
303
+ <a id="member-Camera-lookAt"></a>
304
+
305
+ #### `Camera.lookAt`
306
+
307
+ Rotate the camera to look at a point, as three.js Camera.lookAt.
308
+
309
+ ```ts
310
+ Camera.lookAt(target: Vector3): void
311
+ ```
312
+
313
+ | Parameter | Type | Optional | Doc |
314
+ |---|---|---|---|
315
+ | `target` | `Vector3` | no | The point to look at. |
316
+
317
+ **Returns** `void`.
318
+
319
+ Binding symbol `og_camera_look_at` · publish builds: kept
320
+
321
+ ```ogt
322
+ fn lookAt {
323
+ doc "Rotate the camera to look at a point, as three.js Camera.lookAt."
324
+ param target Vector3 "The point to look at."
325
+ }
326
+ ```
327
+
328
+ <sub>`api.ogt` line 1406</sub>
329
+
330
+ <a id="member-Camera-worldToScreen"></a>
331
+
332
+ #### `Camera.worldToScreen`
333
+
334
+ Where a world point lands on the play surface.
335
+
336
+ ```ts
337
+ Camera.worldToScreen(point: Vector3): Vector2 | null
338
+ ```
339
+
340
+ | Parameter | Type | Optional | Doc |
341
+ |---|---|---|---|
342
+ | `point` | `Vector3` | no | A world point. |
343
+
344
+ **Returns** `Vector2 | null`: CSS pixels, or null behind the camera.
345
+
346
+ Binding symbol `og_camera_world_to_screen` · publish builds: kept
347
+
348
+ ```ogt
349
+ fn worldToScreen {
350
+ doc "Where a world point lands on the play surface."
351
+ param point Vector3 "A world point."
352
+ returns Option.Vector2 "CSS pixels, or null behind the camera."
353
+ }
354
+ ```
355
+
356
+ <sub>`api.ogt` line 1410</sub>
357
+
358
+ <a id="member-Camera-screenToRay"></a>
359
+
360
+ #### `Camera.screenToRay`
361
+
362
+ The ray through a point of the play surface, for picking.
363
+
364
+ ```ts
365
+ Camera.screenToRay(x: number, y: number): Ray
366
+ ```
367
+
368
+ | Parameter | Type | Optional | Doc |
369
+ |---|---|---|---|
370
+ | `x` | `number` | no | Horizontal position in CSS pixels. |
371
+ | `y` | `number` | no | Vertical position in CSS pixels. |
372
+
373
+ **Returns** `Ray`.
374
+
375
+ Binding symbol `og_camera_screen_to_ray` · publish builds: kept
376
+
377
+ ```ogt
378
+ fn screenToRay {
379
+ doc "The ray through a point of the play surface, for picking."
380
+ param x f32 "Horizontal position in CSS pixels."
381
+ param y f32 "Vertical position in CSS pixels."
382
+ returns Ray
383
+ }
384
+ ```
385
+
386
+ <sub>`api.ogt` line 1415</sub>
387
+
388
+ <a id="record-OrbitCamera"></a>
389
+
390
+ ### `og.OrbitCamera` (component)
391
+
392
+ Orbits og.Camera around the entity carrying it, as three.js OrbitControls: a left-button drag on the play surface turns it, the wheel zooms, autoRotate turns it on its own.
393
+
394
+ Camera controllers are game-level systems the engine ships in TypeScript (og.systems.cameras); list them in GameDesc.systems: `systems: [...og.systems.cameras, ...yours]`. The first entity carrying one, in query order, drives the camera.
395
+
396
+ The camera sits `distance` from the orbited point (the entity's position plus `target`) in the direction given by `azimuth` about +Y and `polar` from +Y, and looks at the point. Every angle is computed with deterministic arithmetic, so a replay moves the camera identically on every host.
397
+
398
+ Token `og.OrbitCamera`, registered under the schema name `og.OrbitCamera`; its value type is `OrbitCamera`.
399
+
400
+ | Field | Type | Default | Range | Unit | Notes | Doc |
401
+ |---|---|---|---|---|---|---|
402
+ | `target` | `Vector3` | `{ x: 0, y: 0, z: 0 }` | — | `m` | — | The orbited point, relative to the entity's position. |
403
+ | `distance` | `number` | `10` | ≥ 0.01 | `m` | tunable | How far the camera is from the orbited point, as three.js OrbitControls' distance. |
404
+ | `minDistance` | `number` | `1` | ≥ 0.01 | `m` | — | The closest the wheel zooms in, as three.js OrbitControls.minDistance. |
405
+ | `maxDistance` | `number` | `100` | ≥ 0.01 | `m` | — | The farthest the wheel zooms out, as three.js OrbitControls.maxDistance. |
406
+ | `azimuth` | `number` | `0` | — | `rad` | tunable | The horizontal angle about +Y; 0 puts the camera on the +Z side of the point. |
407
+ | `polar` | `number` | `1.1` | 0 … 3.1416 | `rad` | tunable | The angle from +Y: near 0 looks straight down, half pi is level with the point. |
408
+ | `minPolarAngle` | `number` | `0.05` | 0 … 3.1416 | `rad` | — | The smallest polar angle a drag reaches, as three.js OrbitControls.minPolarAngle. |
409
+ | `maxPolarAngle` | `number` | `3.0916` | 0 … 3.1416 | `rad` | — | The largest polar angle a drag reaches, as three.js OrbitControls.maxPolarAngle. |
410
+ | `rotateSpeed` | `number` | `1` | ≥ 0 | — | tunable | Drag sensitivity, as three.js OrbitControls.rotateSpeed: at 1, dragging the play surface's height turns a full circle. |
411
+ | `zoomSpeed` | `number` | `1` | ≥ 0 | — | tunable | Wheel sensitivity, as three.js OrbitControls.zoomSpeed: at 1, 100 CSS pixels of wheel change the distance by a tenth. |
412
+ | `autoRotate` | `boolean` | `false` | — | — | — | Turn about the point on its own while not dragged, as three.js OrbitControls.autoRotate. |
413
+ | `autoRotateSpeed` | `number` | `0.5` | — | `radps` | tunable | How fast autoRotate turns. |
414
+ | `enabled` | `boolean` | `true` | — | — | — | Read the pointer and the wheel; false keeps only autoRotate and the fields' own values. |
415
+ | `dragging` | `boolean` | `false` | — | — | read only | Controller state: a left-button drag that started on the play surface is in progress. |
416
+ | `pointer` | `Vector2` | `{ x: 0, y: 0 }` | — | `cssPx` | read only | Controller state: where the pointer was on the previous tick of a drag. |
417
+
418
+ ```ogt
419
+ component OrbitCamera {
420
+ doc "Orbits og.Camera around the entity carrying it, as three.js OrbitControls: a left-button drag on the play surface turns it, the wheel zooms, autoRotate turns it on its own."
421
+ doc "Camera controllers are game-level systems the engine ships in TypeScript (og.systems.cameras); list them in GameDesc.systems: `systems: [...og.systems.cameras, ...yours]`. The first entity carrying one, in query order, drives the camera."
422
+ doc "The camera sits `distance` from the orbited point (the entity's position plus `target`) in the direction given by `azimuth` about +Y and `polar` from +Y, and looks at the point. Every angle is computed with deterministic arithmetic, so a replay moves the camera identically on every host."
423
+ field target Vector3 "The orbited point, relative to the entity's position." {
424
+ unit m
425
+ }
426
+ field distance f32 "How far the camera is from the orbited point, as three.js OrbitControls' distance." {
427
+ default 10
428
+ min 0.01
429
+ unit m
430
+ tunable true
431
+ }
432
+ field minDistance f32 "The closest the wheel zooms in, as three.js OrbitControls.minDistance." {
433
+ default 1
434
+ min 0.01
435
+ unit m
436
+ }
437
+ field maxDistance f32 "The farthest the wheel zooms out, as three.js OrbitControls.maxDistance." {
438
+ default 100
439
+ min 0.01
440
+ unit m
441
+ }
442
+ field azimuth f32 "The horizontal angle about +Y; 0 puts the camera on the +Z side of the point." {
443
+ unit rad
444
+ tunable true
445
+ }
446
+ field polar f32 "The angle from +Y: near 0 looks straight down, half pi is level with the point." {
447
+ default 1.1
448
+ min 0
449
+ max 3.1416
450
+ unit rad
451
+ tunable true
452
+ }
453
+ field minPolarAngle f32 "The smallest polar angle a drag reaches, as three.js OrbitControls.minPolarAngle." {
454
+ default 0.05
455
+ min 0
456
+ max 3.1416
457
+ unit rad
458
+ }
459
+ field maxPolarAngle f32 "The largest polar angle a drag reaches, as three.js OrbitControls.maxPolarAngle." {
460
+ default 3.0916
461
+ min 0
462
+ max 3.1416
463
+ unit rad
464
+ }
465
+ field rotateSpeed f32 "Drag sensitivity, as three.js OrbitControls.rotateSpeed: at 1, dragging the play surface's height turns a full circle." {
466
+ default 1
467
+ min 0
468
+ tunable true
469
+ }
470
+ field zoomSpeed f32 "Wheel sensitivity, as three.js OrbitControls.zoomSpeed: at 1, 100 CSS pixels of wheel change the distance by a tenth." {
471
+ default 1
472
+ min 0
473
+ tunable true
474
+ }
475
+ field autoRotate bool "Turn about the point on its own while not dragged, as three.js OrbitControls.autoRotate."
476
+ field autoRotateSpeed f32 "How fast autoRotate turns." {
477
+ default 0.5
478
+ unit radps
479
+ tunable true
480
+ }
481
+ field enabled bool "Read the pointer and the wheel; false keeps only autoRotate and the fields' own values." {
482
+ default true
483
+ }
484
+ field dragging bool "Controller state: a left-button drag that started on the play surface is in progress." {
485
+ readonly true
486
+ }
487
+ field pointer Vector2 "Controller state: where the pointer was on the previous tick of a drag." {
488
+ readonly true
489
+ unit cssPx
490
+ }
491
+ }
492
+ ```
493
+
494
+ <sub>`api.ogt` line 1423</sub>
495
+
496
+ <a id="record-FollowCamera"></a>
497
+
498
+ ### `og.FollowCamera` (component)
499
+
500
+ Chases the entity carrying it with og.Camera: a third-person 3D view that eases towards a point offset from the entity and looks at it. Driven by og.systems.cameras; the first entity carrying one, in query order, drives the camera.
501
+
502
+ Token `og.FollowCamera`, registered under the schema name `og.FollowCamera`; its value type is `FollowCamera`.
503
+
504
+ | Field | Type | Default | Range | Unit | Notes | Doc |
505
+ |---|---|---|---|---|---|---|
506
+ | `offset` | `Vector3` | `{ x: 0, y: 2, z: 6 }` | — | `m` | — | Where the camera sits relative to the entity: in the entity's own axes with followRotation, else in world axes. |
507
+ | `lookOffset` | `Vector3` | `{ x: 0, y: 1, z: 0 }` | — | `m` | — | The point the camera looks at, relative to the entity's position. |
508
+ | `followRotation` | `boolean` | `false` | — | — | — | Turn the offset with the entity's rotation, so the camera stays behind it. |
509
+ | `smoothTime` | `number` | `0.25` | ≥ 0 | `s` | tunable | Roughly how long the camera takes to catch up with a moved entity; 0 snaps it there every tick. |
510
+
511
+ ```ogt
512
+ component FollowCamera {
513
+ doc "Chases the entity carrying it with og.Camera: a third-person 3D view that eases towards a point offset from the entity and looks at it. Driven by og.systems.cameras; the first entity carrying one, in query order, drives the camera."
514
+ field offset Vector3 "Where the camera sits relative to the entity: in the entity's own axes with followRotation, else in world axes." {
515
+ default 0 2 6
516
+ unit m
517
+ }
518
+ field lookOffset Vector3 "The point the camera looks at, relative to the entity's position." {
519
+ default 0 1 0
520
+ unit m
521
+ }
522
+ field followRotation bool "Turn the offset with the entity's rotation, so the camera stays behind it."
523
+ field smoothTime f32 "Roughly how long the camera takes to catch up with a moved entity; 0 snaps it there every tick." {
524
+ default 0.25
525
+ min 0
526
+ unit s
527
+ tunable true
528
+ }
529
+ }
530
+ ```
531
+
532
+ <sub>`api.ogt` line 1497</sub>
533
+
534
+ <a id="record-Follow2D"></a>
535
+
536
+ ### `og.Follow2D` (component)
537
+
538
+ Keeps og.Camera on the entity carrying it in the xy plane, for 2D games: the camera moves only when the entity leaves the dead zone, eases by smoothTime (smoothTimeY for y when set) and, with clamp, stays inside the bounds; lookAhead leads it in the direction the entity moves. The camera keeps its z, rotation and projection. Driven by og.systems.cameras; og.CameraZone entities then keep the view inside the zone the entity is in.
539
+
540
+ Token `og.Follow2D`, registered under the schema name `og.Follow2D`; its value type is `Follow2D`.
541
+
542
+ | Field | Type | Default | Range | Unit | Notes | Doc |
543
+ |---|---|---|---|---|---|---|
544
+ | `offset` | `Vector2` | `{ x: 0, y: 0 }` | — | `m` | — | Where the camera centre sits relative to the entity. |
545
+ | `deadZone` | `Vector2` | `{ x: 0, y: 0 }` | — | `m` | — | Half the width and height of the box around the camera centre inside which the entity moves without moving the camera. |
546
+ | `smoothTime` | `number` | `0.15` | ≥ 0 | `s` | tunable | Roughly how long the camera takes to catch up; 0 snaps it every tick. |
547
+ | `smoothTimeY` | `number` | `-1` | — | `s` | tunable | The same for y alone (a platformer follows jumps more lazily than runs); below 0 uses smoothTime. |
548
+ | `lookAhead` | `number` | `0` | ≥ 0 | `s` | tunable | Lead the entity by its velocity times this many seconds (0: no look-ahead). |
549
+ | `lookAheadMax` | `Vector2` | `{ x: 3, y: 1.5 }` | ≥ 0 | `m` | — | The largest lead along x and y. |
550
+ | `lookAheadSmoothing` | `number` | `0.4` | ≥ 0 | `s` | tunable | Roughly how long the lead takes to turn when the entity does. |
551
+ | `lead` | `Vector2` | `{ x: 0, y: 0 }` | — | `m` | read only | Controller state: the current lead. |
552
+ | `last` | `Vector2` | `{ x: 0, y: 0 }` | — | `m` | read only | Controller state: the entity's position on the previous tick. |
553
+ | `clamp` | `boolean` | `false` | — | — | — | Keep the camera centre between boundsMin and boundsMax. |
554
+ | `boundsMin` | `Vector2` | `{ x: 0, y: 0 }` | — | `m` | — | The smallest x and y the camera centre takes with clamp. |
555
+ | `boundsMax` | `Vector2` | `{ x: 0, y: 0 }` | — | `m` | — | The largest x and y the camera centre takes with clamp. |
556
+
557
+ ```ogt
558
+ component Follow2D {
559
+ doc "Keeps og.Camera on the entity carrying it in the xy plane, for 2D games: the camera moves only when the entity leaves the dead zone, eases by smoothTime (smoothTimeY for y when set) and, with clamp, stays inside the bounds; lookAhead leads it in the direction the entity moves. The camera keeps its z, rotation and projection. Driven by og.systems.cameras; og.CameraZone entities then keep the view inside the zone the entity is in."
560
+ field offset Vector2 "Where the camera centre sits relative to the entity." {
561
+ unit m
562
+ }
563
+ field deadZone Vector2 "Half the width and height of the box around the camera centre inside which the entity moves without moving the camera." {
564
+ unit m
565
+ }
566
+ field smoothTime f32 "Roughly how long the camera takes to catch up; 0 snaps it every tick." {
567
+ default 0.15
568
+ min 0
569
+ unit s
570
+ tunable true
571
+ }
572
+ field smoothTimeY f32 "The same for y alone (a platformer follows jumps more lazily than runs); below 0 uses smoothTime." {
573
+ default -1
574
+ unit s
575
+ tunable true
576
+ }
577
+ field lookAhead f32 "Lead the entity by its velocity times this many seconds (0: no look-ahead)." {
578
+ min 0
579
+ unit s
580
+ tunable true
581
+ }
582
+ field lookAheadMax Vector2 "The largest lead along x and y." {
583
+ default 3 1.5
584
+ min 0
585
+ unit m
586
+ }
587
+ field lookAheadSmoothing f32 "Roughly how long the lead takes to turn when the entity does." {
588
+ default 0.4
589
+ min 0
590
+ unit s
591
+ tunable true
592
+ }
593
+ field lead Vector2 "Controller state: the current lead." {
594
+ readonly true
595
+ unit m
596
+ }
597
+ field last Vector2 "Controller state: the entity's position on the previous tick." {
598
+ readonly true
599
+ unit m
600
+ }
601
+ field clamp bool "Keep the camera centre between boundsMin and boundsMax."
602
+ field boundsMin Vector2 "The smallest x and y the camera centre takes with clamp." {
603
+ unit m
604
+ }
605
+ field boundsMax Vector2 "The largest x and y the camera centre takes with clamp." {
606
+ unit m
607
+ }
608
+ }
609
+ ```
610
+
611
+ <sub>`api.ogt` line 1516</sub>
612
+
613
+ <a id="record-CameraZone"></a>
614
+
615
+ ### `og.CameraZone` (component)
616
+
617
+ A rectangle of the xy plane (min to max, world units, not moved by the entity's Transform) that keeps a 2D view inside it while the entity followed by og.Follow2D is in it: rooms, arenas, a level's bounds. Of overlapping zones the highest priority wins, then the first in query order. The engine's og.camera system picks the zone after the game's systems (into og.Camera's zone fields); entering another zone scrolls the view across over the new zone's scrollTime, or jumps when it is 0. A zone smaller than the view centres it.
618
+
619
+ Token `og.CameraZone`, registered under the schema name `og.CameraZone`; its value type is `CameraZone`.
620
+
621
+ | Field | Type | Default | Range | Unit | Notes | Doc |
622
+ |---|---|---|---|---|---|---|
623
+ | `min` | `Vector2` | `{ x: 0, y: 0 }` | — | `m` | — | The bottom-left corner. |
624
+ | `max` | `Vector2` | `{ x: 10, y: 10 }` | — | `m` | — | The top-right corner. |
625
+ | `priority` | `number` | `0` | — | — | — | Higher wins where zones overlap. |
626
+ | `scrollTime` | `number` | `0` | ≥ 0 | `s` | — | Seconds the view takes to scroll from the zone the entity left into this one (a room transition, eased in and out); 0 jumps at once. Visual only: the camera resource records the transition, so replays scroll the same. |
627
+
628
+ ```ogt
629
+ component CameraZone {
630
+ doc "A rectangle of the xy plane (min to max, world units, not moved by the entity's Transform) that keeps a 2D view inside it while the entity followed by og.Follow2D is in it: rooms, arenas, a level's bounds. Of overlapping zones the highest priority wins, then the first in query order. The engine's og.camera system picks the zone after the game's systems (into og.Camera's zone fields); entering another zone scrolls the view across over the new zone's scrollTime, or jumps when it is 0. A zone smaller than the view centres it."
631
+ field min Vector2 "The bottom-left corner." {
632
+ unit m
633
+ }
634
+ field max Vector2 "The top-right corner." {
635
+ default 10 10
636
+ unit m
637
+ }
638
+ field priority i32 "Higher wins where zones overlap."
639
+ field scrollTime f32 "Seconds the view takes to scroll from the zone the entity left into this one (a room transition, eased in and out); 0 jumps at once. Visual only: the camera resource records the transition, so replays scroll the same." {
640
+ unit s
641
+ min 0
642
+ }
643
+ }
644
+ ```
645
+
646
+ <sub>`api.ogt` line 1568</sub>
647
+
648
+ <a id="record-CameraRail"></a>
649
+
650
+ ### `og.CameraRail` (component)
651
+
652
+ Moves og.Camera along a spline through p0 to p(points - 1) (Catmull-Rom, through every point) to the point nearest the entity carrying it, easing by smoothTime: a corridor, a side-scroller's track, a 3D chase on rails. A perspective camera looks at the entity; an orthographic one keeps its z and rotation. Applied by the engine's og.camera system after the game's systems.
653
+
654
+ Token `og.CameraRail`, registered under the schema name `og.CameraRail`; its value type is `CameraRail`.
655
+
656
+ | Field | Type | Default | Range | Unit | Notes | Doc |
657
+ |---|---|---|---|---|---|---|
658
+ | `points` | `number` | `2` | 2 … 8 | — | — | How many of p0...p7 the rail uses (2 to 8). |
659
+ | `p0` | `Vector3` | `{ x: 0, y: 0, z: 0 }` | — | `m` | — | Rail point 0. |
660
+ | `p1` | `Vector3` | `{ x: 10, y: 0, z: 0 }` | — | `m` | — | Rail point 1. |
661
+ | `p2` | `Vector3` | `{ x: 0, y: 0, z: 0 }` | — | `m` | — | Rail point 2. |
662
+ | `p3` | `Vector3` | `{ x: 0, y: 0, z: 0 }` | — | `m` | — | Rail point 3. |
663
+ | `p4` | `Vector3` | `{ x: 0, y: 0, z: 0 }` | — | `m` | — | Rail point 4. |
664
+ | `p5` | `Vector3` | `{ x: 0, y: 0, z: 0 }` | — | `m` | — | Rail point 5. |
665
+ | `p6` | `Vector3` | `{ x: 0, y: 0, z: 0 }` | — | `m` | — | Rail point 6. |
666
+ | `p7` | `Vector3` | `{ x: 0, y: 0, z: 0 }` | — | `m` | — | Rail point 7. |
667
+ | `smoothTime` | `number` | `0.2` | ≥ 0 | `s` | tunable | Roughly how long the camera takes to catch up along the rail; 0 snaps. |
668
+
669
+ ```ogt
670
+ component CameraRail {
671
+ doc "Moves og.Camera along a spline through p0 to p(points - 1) (Catmull-Rom, through every point) to the point nearest the entity carrying it, easing by smoothTime: a corridor, a side-scroller's track, a 3D chase on rails. A perspective camera looks at the entity; an orthographic one keeps its z and rotation. Applied by the engine's og.camera system after the game's systems."
672
+ field points u32 "How many of p0...p7 the rail uses (2 to 8)." {
673
+ default 2
674
+ min 2
675
+ max 8
676
+ }
677
+ field p0 Vector3 "Rail point 0." {
678
+ unit m
679
+ }
680
+ field p1 Vector3 "Rail point 1." {
681
+ default 10 0 0
682
+ unit m
683
+ }
684
+ field p2 Vector3 "Rail point 2." {
685
+ unit m
686
+ }
687
+ field p3 Vector3 "Rail point 3." {
688
+ unit m
689
+ }
690
+ field p4 Vector3 "Rail point 4." {
691
+ unit m
692
+ }
693
+ field p5 Vector3 "Rail point 5." {
694
+ unit m
695
+ }
696
+ field p6 Vector3 "Rail point 6." {
697
+ unit m
698
+ }
699
+ field p7 Vector3 "Rail point 7." {
700
+ unit m
701
+ }
702
+ field smoothTime f32 "Roughly how long the camera takes to catch up along the rail; 0 snaps." {
703
+ default 0.2
704
+ min 0
705
+ unit s
706
+ tunable true
707
+ }
708
+ }
709
+ ```
710
+
711
+ <sub>`api.ogt` line 1584</sub>