@edv4h/usketch-plugin-character 0.2.2 → 0.3.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.
- package/README.md +26 -7
- package/dist/character-input.d.ts +4 -2
- package/dist/character-input.d.ts.map +1 -1
- package/dist/character-input.js +41 -4
- package/dist/character-input.js.map +1 -1
- package/dist/character-layer.d.ts +3 -1
- package/dist/character-layer.d.ts.map +1 -1
- package/dist/character-layer.js +29 -6
- package/dist/character-layer.js.map +1 -1
- package/dist/character-physics.d.ts +55 -2
- package/dist/character-physics.d.ts.map +1 -1
- package/dist/character-physics.js +90 -9
- package/dist/character-physics.js.map +1 -1
- package/dist/character-runtime.d.ts.map +1 -1
- package/dist/character-runtime.js +13 -5
- package/dist/character-runtime.js.map +1 -1
- package/dist/character-service.d.ts +6 -2
- package/dist/character-service.d.ts.map +1 -1
- package/dist/character-service.js +2 -0
- package/dist/character-service.js.map +1 -1
- package/dist/character-store.d.ts +8 -1
- package/dist/character-store.d.ts.map +1 -1
- package/dist/character-store.js +40 -4
- package/dist/character-store.js.map +1 -1
- package/dist/character-sync.d.ts +7 -1
- package/dist/character-sync.d.ts.map +1 -1
- package/dist/character-sync.js +13 -1
- package/dist/character-sync.js.map +1 -1
- package/dist/character-types.d.ts +13 -0
- package/dist/character-types.d.ts.map +1 -1
- package/dist/character-types.js +1 -0
- package/dist/character-types.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/plugin.d.ts +7 -2
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +1 -0
- package/dist/plugin.js.map +1 -1
- package/dist/register-character-hud.d.ts.map +1 -1
- package/dist/register-character-hud.js +12 -0
- package/dist/register-character-hud.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -23,6 +23,7 @@ createCharacterPlugin({
|
|
|
23
23
|
keys: { up: ["KeyW", "ArrowUp"] }, // KeyboardEvent.code values
|
|
24
24
|
cameraMode: "rotate", // "fixed" | "rotate" | "free"
|
|
25
25
|
controlScheme: "vehicle", // "directional" | "vehicle"
|
|
26
|
+
drift: true, // vehicle: Space + steer drifts (or tuning overrides)
|
|
26
27
|
screenAnchor: { x: 0.5, y: 0.75 },
|
|
27
28
|
});
|
|
28
29
|
```
|
|
@@ -32,8 +33,8 @@ createCharacterPlugin({
|
|
|
32
33
|
- **Heading**: degrees, `0` = up (world −y), clockwise-positive — the same convention
|
|
33
34
|
as CSS `rotate()` and the viewport `rotation`.
|
|
34
35
|
- **Render props**: `heading` (world), `screenHeading` (= `heading + viewport.rotation`,
|
|
35
|
-
what to rotate a top-down sprite by), `moving`, `speed`, `
|
|
36
|
-
`name`, `isSelf`, `id`. Each character is placed centered on its screen position
|
|
36
|
+
what to rotate a top-down sprite by), `moving`, `speed`, `steering`, `slip`,
|
|
37
|
+
`drifting`, `zoom`, `appearance`, `name`, `isSelf`, `id`, `elevation`. Each character is placed centered on its screen position
|
|
37
38
|
in one screen-space layer, so self and remote characters look the same under zoom
|
|
38
39
|
and camera rotation.
|
|
39
40
|
- **Control schemes**
|
|
@@ -41,7 +42,17 @@ createCharacterPlugin({
|
|
|
41
42
|
turns toward the movement at `turnRate`. With the `rotate` camera, left/right
|
|
42
43
|
therefore circle (the camera follows the turn).
|
|
43
44
|
- `vehicle` — up/down throttle and reverse, left/right steer. Steering scales
|
|
44
|
-
with speed (a stopped car can't turn) and inverts in reverse.
|
|
45
|
+
with speed (a stopped car can't turn) and inverts in reverse. The held steering
|
|
46
|
+
(-1 … 1) is in the pose and render props, e.g. to turn the front wheels.
|
|
47
|
+
- **Drift** (`vehicle`, opt-in via `drift`): hold the drift key (Space) and steer at
|
|
48
|
+
speed to start an arcade drift toward the steering. It turns tighter than normal
|
|
49
|
+
steering and slides the body by `slip` degrees (draw the car at `heading + slip`;
|
|
50
|
+
it keeps traveling along `heading`). Steering into the drift tightens it,
|
|
51
|
+
countersteering opens it (never spins). Releasing the key, slowing below
|
|
52
|
+
`stopSpeed` or reversing ends it, and the slip eases back. Tuning (`DriftParams`):
|
|
53
|
+
`startSpeed` / `stopSpeed` (fractions of `moveSpeed`), `turnRate` / `steerRate`
|
|
54
|
+
(multiples of `turnRate`), `slipAngle` / `steerSlipAngle` (degrees), `recoveryRate`
|
|
55
|
+
(1/s). The drift key is only captured while drift is on.
|
|
45
56
|
- **Camera modes**
|
|
46
57
|
- `fixed` — follow, world stays upright.
|
|
47
58
|
- `rotate` — follow and turn the world by `-heading` (character always faces up).
|
|
@@ -51,8 +62,15 @@ createCharacterPlugin({
|
|
|
51
62
|
following. Turning the character off turns the camera back upright.
|
|
52
63
|
- **Multiplayer**: pass `wsProvider` (anything with a y-protocols `awareness`). Your
|
|
53
64
|
character is published under the `character` awareness field (~20 Hz, only when it
|
|
54
|
-
changes) and others are eased between
|
|
65
|
+
changes, including `steering`, `slip` and `drifting`) and others are eased between
|
|
66
|
+
updates. It's ephemeral: a character
|
|
55
67
|
vanishes when its owner disconnects or turns it off. Nothing is stored as shapes.
|
|
68
|
+
- **Ground height**: when a plugin provides `groundHeightService` (from
|
|
69
|
+
`@edv4h/usketch-shared`, e.g. the map plugin's raised terrain), moving onto
|
|
70
|
+
ground more than `motion.maxStep` (default 24 world units, HUD "登れる段差") higher
|
|
71
|
+
than where the character stands is blocked; it slides along the cliff instead.
|
|
72
|
+
Stepping down is always allowed. The render props carry `elevation`, and under a
|
|
73
|
+
3D view (Mode 7) the character is lifted onto the ground it stands on.
|
|
56
74
|
- **Input**: held keys are tracked from window `keydown`/`keyup` (capture phase,
|
|
57
75
|
`event.code`), swallowed while the character is on so single-letter tool
|
|
58
76
|
shortcuts don't fire. Typing in text fields, and key chords with Ctrl/Cmd/Alt,
|
|
@@ -60,8 +78,8 @@ createCharacterPlugin({
|
|
|
60
78
|
|
|
61
79
|
## HUD
|
|
62
80
|
|
|
63
|
-
A "キャラクター" settings group (on/off, camera, scheme, speed, turn rate,
|
|
64
|
-
position, camera lag) plus actions to toggle the character and to place it at the
|
|
81
|
+
A "キャラクター" settings group (on/off, camera, scheme, drift, speed, turn rate,
|
|
82
|
+
climbable step, screen position, camera lag) plus actions to toggle the character and to place it at the
|
|
65
83
|
screen position.
|
|
66
84
|
|
|
67
85
|
## Service
|
|
@@ -73,7 +91,8 @@ const api = getCharacterApi(app.services);
|
|
|
73
91
|
api?.enable();
|
|
74
92
|
api?.setCameraMode("rotate");
|
|
75
93
|
api?.setRenderer(myRenderer);
|
|
76
|
-
api?.
|
|
94
|
+
api?.setDrift({ slipAngle: 35 }); // true / false / tuning overrides
|
|
95
|
+
api?.getPose(); // { x, y, heading, speed, moving, steering, slip, drift }
|
|
77
96
|
```
|
|
78
97
|
|
|
79
98
|
## Limitations
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { MoveInput } from "./character-physics.js";
|
|
2
2
|
import type { CharacterKeys } from "./character-types.js";
|
|
3
3
|
export interface KeyInput {
|
|
4
|
-
/** The currently held directions. */
|
|
4
|
+
/** The currently held directions (and the drift key). */
|
|
5
5
|
read(): MoveInput;
|
|
6
6
|
/** Whether any bound key is held. */
|
|
7
7
|
anyHeld(): boolean;
|
|
@@ -14,5 +14,7 @@ export interface KeyInput {
|
|
|
14
14
|
* false no key is captured (and none is swallowed). Held keys are cleared on window
|
|
15
15
|
* blur / tab hide so a key released elsewhere can't get stuck "down".
|
|
16
16
|
*/
|
|
17
|
-
export declare function createKeyInput(initialKeys: CharacterKeys, isActive: () => boolean
|
|
17
|
+
export declare function createKeyInput(initialKeys: CharacterKeys, isActive: () => boolean,
|
|
18
|
+
/** Whether the drift key does anything now (else it is left to the host, e.g. Space-pan). */
|
|
19
|
+
isDriftActive?: () => boolean): KeyInput;
|
|
18
20
|
//# sourceMappingURL=character-input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"character-input.d.ts","sourceRoot":"","sources":["../src/character-input.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,WAAW,QAAQ;IACxB,
|
|
1
|
+
{"version":3,"file":"character-input.d.ts","sourceRoot":"","sources":["../src/character-input.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,WAAW,QAAQ;IACxB,yDAAyD;IACzD,IAAI,IAAI,SAAS,CAAC;IAClB,qCAAqC;IACrC,OAAO,IAAI,OAAO,CAAC;IACnB,wDAAwD;IACxD,OAAO,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,CAAC;IACnC,OAAO,IAAI,IAAI,CAAC;CAChB;AAkDD;;;;GAIG;AACH,wBAAgB,cAAc,CAC7B,WAAW,EAAE,aAAa,EAC1B,QAAQ,EAAE,MAAM,OAAO;AACvB,6FAA6F;AAC7F,aAAa,GAAE,MAAM,OAAqB,GACxC,QAAQ,CAkEV"}
|
package/dist/character-input.js
CHANGED
|
@@ -10,6 +10,34 @@ const NON_TEXT_INPUTS = new Set([
|
|
|
10
10
|
"file",
|
|
11
11
|
"image",
|
|
12
12
|
]);
|
|
13
|
+
/** ARIA widgets Space activates or types into. */
|
|
14
|
+
const SPACE_ROLES = new Set([
|
|
15
|
+
"button",
|
|
16
|
+
"checkbox",
|
|
17
|
+
"combobox",
|
|
18
|
+
"link",
|
|
19
|
+
"menuitem",
|
|
20
|
+
"menuitemcheckbox",
|
|
21
|
+
"menuitemradio",
|
|
22
|
+
"option",
|
|
23
|
+
"radio",
|
|
24
|
+
"slider",
|
|
25
|
+
"switch",
|
|
26
|
+
"tab",
|
|
27
|
+
"textbox",
|
|
28
|
+
]);
|
|
29
|
+
/** Elements Space activates (or types into): the drift key must not steal it from them. */
|
|
30
|
+
function isSpaceTarget(target) {
|
|
31
|
+
const el = target;
|
|
32
|
+
if (!el || typeof el.tagName !== "string")
|
|
33
|
+
return false;
|
|
34
|
+
if (["INPUT", "TEXTAREA", "SELECT", "BUTTON", "A", "SUMMARY"].includes(el.tagName))
|
|
35
|
+
return true;
|
|
36
|
+
if (el.isContentEditable === true)
|
|
37
|
+
return true;
|
|
38
|
+
const role = typeof el.getAttribute === "function" ? el.getAttribute("role") : null;
|
|
39
|
+
return role !== null && SPACE_ROLES.has(role);
|
|
40
|
+
}
|
|
13
41
|
function isTextInput(target) {
|
|
14
42
|
const el = target;
|
|
15
43
|
if (!el || typeof el.tagName !== "string")
|
|
@@ -24,7 +52,9 @@ function isTextInput(target) {
|
|
|
24
52
|
* false no key is captured (and none is swallowed). Held keys are cleared on window
|
|
25
53
|
* blur / tab hide so a key released elsewhere can't get stuck "down".
|
|
26
54
|
*/
|
|
27
|
-
export function createKeyInput(initialKeys, isActive
|
|
55
|
+
export function createKeyInput(initialKeys, isActive,
|
|
56
|
+
/** Whether the drift key does anything now (else it is left to the host, e.g. Space-pan). */
|
|
57
|
+
isDriftActive = () => false) {
|
|
28
58
|
let keys = initialKeys;
|
|
29
59
|
const held = new Set();
|
|
30
60
|
const directionOf = (code) => {
|
|
@@ -32,6 +62,8 @@ export function createKeyInput(initialKeys, isActive) {
|
|
|
32
62
|
if (keys[dir].includes(code))
|
|
33
63
|
return dir;
|
|
34
64
|
}
|
|
65
|
+
if (keys.drift?.includes(code) && isDriftActive())
|
|
66
|
+
return "drift";
|
|
35
67
|
return null;
|
|
36
68
|
};
|
|
37
69
|
const onKeyDown = (e) => {
|
|
@@ -39,7 +71,10 @@ export function createKeyInput(initialKeys, isActive) {
|
|
|
39
71
|
return;
|
|
40
72
|
if (e.ctrlKey || e.metaKey || e.altKey)
|
|
41
73
|
return; // leave chords (Cmd+S …) alone
|
|
42
|
-
|
|
74
|
+
const dir = directionOf(e.code);
|
|
75
|
+
if (!dir)
|
|
76
|
+
return;
|
|
77
|
+
if (dir === "drift" && isSpaceTarget(e.target))
|
|
43
78
|
return;
|
|
44
79
|
held.add(e.code);
|
|
45
80
|
e.preventDefault();
|
|
@@ -63,17 +98,19 @@ export function createKeyInput(initialKeys, isActive) {
|
|
|
63
98
|
window.addEventListener("blur", clear);
|
|
64
99
|
document.addEventListener("visibilitychange", onVisibility);
|
|
65
100
|
}
|
|
66
|
-
const isHeld = (dir) => keys[dir]
|
|
101
|
+
const isHeld = (dir) => keys[dir]?.some((c) => held.has(c)) ?? false;
|
|
67
102
|
return {
|
|
68
103
|
read: () => ({
|
|
69
104
|
up: isHeld("up"),
|
|
70
105
|
down: isHeld("down"),
|
|
71
106
|
left: isHeld("left"),
|
|
72
107
|
right: isHeld("right"),
|
|
108
|
+
drift: isHeld("drift"),
|
|
73
109
|
}),
|
|
74
110
|
anyHeld: () => held.size > 0,
|
|
75
111
|
setKeys(next) {
|
|
76
|
-
|
|
112
|
+
// Rebinding movement keeps the drift key unless `drift` is given (`[]` unbinds).
|
|
113
|
+
keys = { ...next, drift: next.drift ?? keys.drift };
|
|
77
114
|
held.clear();
|
|
78
115
|
},
|
|
79
116
|
dispose() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"character-input.js","sourceRoot":"","sources":["../src/character-input.ts"],"names":[],"mappings":"AAkBA,6FAA6F;AAC7F,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IAC/B,UAAU;IACV,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;CACP,CAAC,CAAC;AAEH,SAAS,WAAW,CAAC,MAA0B;IAC9C,MAAM,EAAE,GAAG,MAAkD,CAAC;IAC9D,IAAI,CAAC,EAAE,IAAI,OAAO,EAAE,CAAC,OAAO,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACxD,MAAM,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC;IACvB,IAAI,GAAG,KAAK,OA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ACH,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type Viewport } from "@edv4h/usketch-shared";
|
|
2
|
+
import type { HeightAt } from "./character-physics.js";
|
|
2
3
|
import type { CharacterStore } from "./character-store.js";
|
|
3
|
-
export declare function CharacterLayer({ store, viewport }: {
|
|
4
|
+
export declare function CharacterLayer({ store, viewport, heightAt, }: {
|
|
4
5
|
store: CharacterStore;
|
|
5
6
|
viewport: Viewport;
|
|
7
|
+
heightAt?: HeightAt;
|
|
6
8
|
}): import("react").JSX.Element | null;
|
|
7
9
|
//# sourceMappingURL=character-layer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"character-layer.d.ts","sourceRoot":"","sources":["../src/character-layer.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,QAAQ,EAA4C,MAAM,uBAAuB,CAAC;AAEhG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"character-layer.d.ts","sourceRoot":"","sources":["../src/character-layer.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,QAAQ,EAA4C,MAAM,uBAAuB,CAAC;AAEhG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAsC3D,wBAAgB,cAAc,CAAC,EAC9B,KAAK,EACL,QAAQ,EACR,QAAQ,GACR,EAAE;IACF,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACpB,sCA+EA"}
|
package/dist/character-layer.js
CHANGED
|
@@ -6,10 +6,18 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
6
6
|
// `screenHeading` math under camera rotation).
|
|
7
7
|
import { viewportRotation, worldToScreen, wrapDeg } from "@edv4h/usketch-shared";
|
|
8
8
|
import { useSyncExternalStore } from "react";
|
|
9
|
-
function Spot({ x, y, renderer, props, }) {
|
|
10
|
-
return (_jsx("div", { "data-character-id": props.id, style: {
|
|
9
|
+
function Spot({ x, y, lift, renderer, props, }) {
|
|
10
|
+
return (_jsx("div", { "data-character-id": props.id, style: {
|
|
11
|
+
position: "absolute",
|
|
12
|
+
left: x,
|
|
13
|
+
top: y,
|
|
14
|
+
width: 0,
|
|
15
|
+
height: 0,
|
|
16
|
+
pointerEvents: "none",
|
|
17
|
+
transform: lift > 0 ? `translateZ(${lift}px)` : undefined,
|
|
18
|
+
}, children: _jsx("div", { style: { position: "absolute", left: 0, top: 0, transform: "translate(-50%, -50%)" }, children: renderer(props) }) }));
|
|
11
19
|
}
|
|
12
|
-
export function CharacterLayer({ store, viewport }) {
|
|
20
|
+
export function CharacterLayer({ store, viewport, heightAt, }) {
|
|
13
21
|
const state = useSyncExternalStore(store.subscribe, store.getState, store.getState);
|
|
14
22
|
const renderer = store.getRenderer();
|
|
15
23
|
if (!renderer)
|
|
@@ -18,36 +26,51 @@ export function CharacterLayer({ store, viewport }) {
|
|
|
18
26
|
const spots = [];
|
|
19
27
|
for (const r of state.remotes.values()) {
|
|
20
28
|
const p = worldToScreen(r.x, r.y, viewport);
|
|
21
|
-
|
|
29
|
+
const elevation = heightAt?.(r.x, r.y) ?? 0;
|
|
30
|
+
spots.push(_jsx(Spot, { x: p.x, y: p.y, lift: elevation * viewport.zoom, renderer: renderer, props: {
|
|
22
31
|
id: r.id,
|
|
23
32
|
isSelf: false,
|
|
24
33
|
heading: r.heading,
|
|
25
34
|
screenHeading: wrapDeg(r.heading + rot),
|
|
26
35
|
moving: r.moving,
|
|
27
36
|
speed: r.speed,
|
|
37
|
+
steering: r.steering,
|
|
38
|
+
slip: r.slip,
|
|
39
|
+
drifting: r.drifting,
|
|
28
40
|
zoom: viewport.zoom,
|
|
29
41
|
appearance: r.appearance,
|
|
30
42
|
name: r.name,
|
|
43
|
+
elevation,
|
|
31
44
|
} }, `remote-${r.id}`));
|
|
32
45
|
}
|
|
33
46
|
if (state.enabled && state.spawned) {
|
|
34
47
|
const { pose } = state;
|
|
35
48
|
const p = worldToScreen(pose.x, pose.y, viewport);
|
|
49
|
+
const elevation = heightAt?.(pose.x, pose.y) ?? 0;
|
|
36
50
|
// Self last → drawn on top of the others.
|
|
37
|
-
spots.push(_jsx(Spot, { x: p.x, y: p.y, renderer: renderer, props: {
|
|
51
|
+
spots.push(_jsx(Spot, { x: p.x, y: p.y, lift: elevation * viewport.zoom, renderer: renderer, props: {
|
|
38
52
|
id: "self",
|
|
39
53
|
isSelf: true,
|
|
40
54
|
heading: pose.heading,
|
|
41
55
|
screenHeading: wrapDeg(pose.heading + rot),
|
|
42
56
|
moving: pose.moving,
|
|
43
57
|
speed: pose.speed,
|
|
58
|
+
steering: pose.steering,
|
|
59
|
+
slip: pose.slip,
|
|
60
|
+
drifting: pose.drift !== 0,
|
|
44
61
|
zoom: viewport.zoom,
|
|
45
62
|
appearance: state.appearance,
|
|
46
63
|
name: state.name,
|
|
64
|
+
elevation,
|
|
47
65
|
} }, "self"));
|
|
48
66
|
}
|
|
49
67
|
if (spots.length === 0)
|
|
50
68
|
return null;
|
|
51
|
-
return _jsx("div", { style: {
|
|
69
|
+
return (_jsx("div", { style: {
|
|
70
|
+
position: "absolute",
|
|
71
|
+
inset: 0,
|
|
72
|
+
pointerEvents: "none",
|
|
73
|
+
transformStyle: "preserve-3d",
|
|
74
|
+
}, children: spots }));
|
|
52
75
|
}
|
|
53
76
|
//# sourceMappingURL=character-layer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"character-layer.js","sourceRoot":"","sources":["../src/character-layer.tsx"],"names":[],"mappings":";AAAA,mFAAmF;AACnF,qFAAqF;AACrF,iFAAiF;AACjF,8EAA8E;AAC9E,+CAA+C;AAC/C,OAAO,EAAiB,gBAAgB,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,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8 @@ export interface MoveInput {
|
|
|
5
5
|
down: boolean;
|
|
6
6
|
left: boolean;
|
|
7
7
|
right: boolean;
|
|
8
|
+
/** Vehicle: the drift key (only acts when drift is enabled). */
|
|
9
|
+
drift?: boolean;
|
|
8
10
|
}
|
|
9
11
|
export declare const NO_INPUT: MoveInput;
|
|
10
12
|
export interface CharacterPose {
|
|
@@ -17,7 +19,18 @@ export interface CharacterPose {
|
|
|
17
19
|
speed: number;
|
|
18
20
|
/** Whether the character moved this step. */
|
|
19
21
|
moving: boolean;
|
|
22
|
+
/** Vehicle: the held steering, -1 (left) … 1 (right). 0 for `directional`. */
|
|
23
|
+
steering: number;
|
|
24
|
+
/**
|
|
25
|
+
* Vehicle: body yaw relative to `heading`, degrees (clockwise-positive). The car
|
|
26
|
+
* travels along `heading` but is drawn at `heading + slip` while drifting.
|
|
27
|
+
*/
|
|
28
|
+
slip: number;
|
|
29
|
+
/** Vehicle: the running drift's direction, -1 (left) / 1 (right), 0 = not drifting. */
|
|
30
|
+
drift: -1 | 0 | 1;
|
|
20
31
|
}
|
|
32
|
+
/** A pose at rest at the origin, facing up. */
|
|
33
|
+
export declare const ORIGIN_POSE: CharacterPose;
|
|
21
34
|
export interface MotionParams {
|
|
22
35
|
/** Top speed, world units / s. */
|
|
23
36
|
moveSpeed: number;
|
|
@@ -29,8 +42,37 @@ export interface MotionParams {
|
|
|
29
42
|
friction: number;
|
|
30
43
|
/** Vehicle: reverse top speed as a fraction of `moveSpeed`. */
|
|
31
44
|
reverseRatio: number;
|
|
45
|
+
/** Tallest step up the character can climb, world units (ground height, e.g. the map
|
|
46
|
+
* plugin's raised terrain). Stepping DOWN is always allowed. */
|
|
47
|
+
maxStep: number;
|
|
32
48
|
}
|
|
33
49
|
export declare const DEFAULT_MOTION: MotionParams;
|
|
50
|
+
/**
|
|
51
|
+
* Vehicle drift tuning: holding the drift key while steering at speed starts an
|
|
52
|
+
* arcade drift (a tighter turn with the body slid into it); releasing the key,
|
|
53
|
+
* slowing down or reversing ends it, and the slip eases back.
|
|
54
|
+
*/
|
|
55
|
+
export interface DriftParams {
|
|
56
|
+
/** Speed that starts a drift, as a fraction of `moveSpeed`. */
|
|
57
|
+
startSpeed: number;
|
|
58
|
+
/** Speed below which a drift ends, as a fraction of `moveSpeed`. */
|
|
59
|
+
stopSpeed: number;
|
|
60
|
+
/** Turn rate while drifting, as a multiple of `turnRate`. */
|
|
61
|
+
turnRate: number;
|
|
62
|
+
/**
|
|
63
|
+
* How much steering tightens (into the drift) or opens (against it) the turn,
|
|
64
|
+
* as a multiple of `turnRate`. Capped at the drift `turnRate`, so
|
|
65
|
+
* countersteering never turns the car the other way.
|
|
66
|
+
*/
|
|
67
|
+
steerRate: number;
|
|
68
|
+
/** Body slip while drifting, degrees. */
|
|
69
|
+
slipAngle: number;
|
|
70
|
+
/** Extra slip when steering into the drift, degrees. */
|
|
71
|
+
steerSlipAngle: number;
|
|
72
|
+
/** How fast the slip follows its target (1/s, exponential). */
|
|
73
|
+
recoveryRate: number;
|
|
74
|
+
}
|
|
75
|
+
export declare const DEFAULT_DRIFT: DriftParams;
|
|
34
76
|
/** Unit vector of a heading in world space (0° → (0, -1), 90° → (1, 0)). */
|
|
35
77
|
export declare function headingVector(deg: number): {
|
|
36
78
|
x: number;
|
|
@@ -49,7 +91,18 @@ export declare function turnToward(from: number, to: number, maxStep: number): n
|
|
|
49
91
|
* rather than snapping keeps a heading-following camera from spinning.)
|
|
50
92
|
* - `vehicle`: up/down are throttle/reverse along the heading, left/right steer.
|
|
51
93
|
* Steering authority scales with speed (a stopped car can't turn) and inverts
|
|
52
|
-
* when reversing, like a car.
|
|
94
|
+
* when reversing, like a car. With `driftParams`, holding the drift key while
|
|
95
|
+
* steering at speed drifts (see `DriftParams`).
|
|
96
|
+
*/
|
|
97
|
+
export declare function stepCharacter(pose: CharacterPose, input: MoveInput, dt: number, scheme: ControlScheme, params: MotionParams, cameraRotation?: number, driftParams?: DriftParams | null): CharacterPose;
|
|
98
|
+
/** Ground height at a world point (world units; see `groundHeightService`). */
|
|
99
|
+
export type HeightAt = (x: number, y: number) => number;
|
|
100
|
+
/**
|
|
101
|
+
* Keep a step from `prev` to `next` on climbable ground: moving onto ground more than
|
|
102
|
+
* `maxStep` higher than where the character stands is blocked. A blocked move first
|
|
103
|
+
* tries to slide along the cliff (keep only the x or only the y part), so walking into
|
|
104
|
+
* a wall at an angle glides along it; failing both, the character stays put (a
|
|
105
|
+
* vehicle also loses its speed, as if it bumped the wall). The heading still turns.
|
|
53
106
|
*/
|
|
54
|
-
export declare function
|
|
107
|
+
export declare function constrainToGround(prev: CharacterPose, next: CharacterPose, heightAt: HeightAt, maxStep: number): CharacterPose;
|
|
55
108
|
//# sourceMappingURL=character-physics.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"character-physics.d.ts","sourceRoot":"","sources":["../src/character-physics.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG,SAAS,CAAC;AAEtD,oDAAoD;AACpD,MAAM,WAAW,SAAS;IACzB,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"character-physics.d.ts","sourceRoot":"","sources":["../src/character-physics.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG,SAAS,CAAC;AAEtD,oDAAoD;AACpD,MAAM,WAAW,SAAS;IACzB,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,gEAAgE;IAChE,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,eAAO,MAAM,QAAQ,EAAE,SAMtB,CAAC;AAEF,MAAM,WAAW,aAAa;IAC7B,sBAAsB;IACtB,CAAC,EAAE,MAAM,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M,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAGnE;AAED,oDAAoD;AACpD,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED,iFAAiF;AACjF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAI5E;AAOD;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAC5B,IAAI,EAAE,aAAa,EACnB,KAAK,EAAE,SAAS,EAChB,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,YAAY,EACpB,cAAc,SAAI,EAClB,WAAW,GAAE,WAAW,GAAG,IAAW,GACpC,aAAa,CAsEf;AAED,+EAA+E;AAC/E,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;AAExD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAChC,IAAI,EAAE,aAAa,EACnB,IAAI,EAAE,aAAa,EACnB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,MAAM,GACb,aAAa,CAQf"}
|
|
@@ -2,13 +2,40 @@
|
|
|
2
2
|
// 0 = up (world -y), clockwise-positive — the same convention as CSS `rotate()` and
|
|
3
3
|
// the Core viewport `rotation`, so `screenHeading = heading + viewport.rotation`.
|
|
4
4
|
import { shortestAngleDelta, wrapDeg } from "@edv4h/usketch-shared";
|
|
5
|
-
export const NO_INPUT = {
|
|
5
|
+
export const NO_INPUT = {
|
|
6
|
+
up: false,
|
|
7
|
+
down: false,
|
|
8
|
+
left: false,
|
|
9
|
+
right: false,
|
|
10
|
+
drift: false,
|
|
11
|
+
};
|
|
12
|
+
/** A pose at rest at the origin, facing up. */
|
|
13
|
+
export const ORIGIN_POSE = {
|
|
14
|
+
x: 0,
|
|
15
|
+
y: 0,
|
|
16
|
+
heading: 0,
|
|
17
|
+
speed: 0,
|
|
18
|
+
moving: false,
|
|
19
|
+
steering: 0,
|
|
20
|
+
slip: 0,
|
|
21
|
+
drift: 0,
|
|
22
|
+
};
|
|
6
23
|
export const DEFAULT_MOTION = {
|
|
7
24
|
moveSpeed: 400,
|
|
8
25
|
turnRate: 240,
|
|
9
26
|
acceleration: 900,
|
|
10
27
|
friction: 700,
|
|
11
28
|
reverseRatio: 0.5,
|
|
29
|
+
maxStep: 24,
|
|
30
|
+
};
|
|
31
|
+
export const DEFAULT_DRIFT = {
|
|
32
|
+
startSpeed: 0.27,
|
|
33
|
+
stopSpeed: 0.17,
|
|
34
|
+
turnRate: 1.27,
|
|
35
|
+
steerRate: 0.23,
|
|
36
|
+
slipAngle: 28,
|
|
37
|
+
steerSlipAngle: 8,
|
|
38
|
+
recoveryRate: 8,
|
|
12
39
|
};
|
|
13
40
|
/** Unit vector of a heading in world space (0° → (0, -1), 90° → (1, 0)). */
|
|
14
41
|
export function headingVector(deg) {
|
|
@@ -40,9 +67,10 @@ function approach(v, target, step) {
|
|
|
40
67
|
* rather than snapping keeps a heading-following camera from spinning.)
|
|
41
68
|
* - `vehicle`: up/down are throttle/reverse along the heading, left/right steer.
|
|
42
69
|
* Steering authority scales with speed (a stopped car can't turn) and inverts
|
|
43
|
-
* when reversing, like a car.
|
|
70
|
+
* when reversing, like a car. With `driftParams`, holding the drift key while
|
|
71
|
+
* steering at speed drifts (see `DriftParams`).
|
|
44
72
|
*/
|
|
45
|
-
export function stepCharacter(pose, input, dt, scheme, params, cameraRotation = 0) {
|
|
73
|
+
export function stepCharacter(pose, input, dt, scheme, params, cameraRotation = 0, driftParams = null) {
|
|
46
74
|
if (dt <= 0)
|
|
47
75
|
return pose;
|
|
48
76
|
if (scheme === "directional") {
|
|
@@ -61,6 +89,9 @@ export function stepCharacter(pose, input, dt, scheme, params, cameraRotation =
|
|
|
61
89
|
heading: turnToward(pose.heading, target, params.turnRate * dt),
|
|
62
90
|
speed: params.moveSpeed,
|
|
63
91
|
moving: true,
|
|
92
|
+
steering: 0,
|
|
93
|
+
slip: 0,
|
|
94
|
+
drift: 0,
|
|
64
95
|
};
|
|
65
96
|
}
|
|
66
97
|
const throttle = (input.up ? 1 : 0) - (input.down ? 1 : 0);
|
|
@@ -77,12 +108,24 @@ export function stepCharacter(pose, input, dt, scheme, params, cameraRotation =
|
|
|
77
108
|
else {
|
|
78
109
|
speed = approach(speed, 0, params.friction * dt);
|
|
79
110
|
}
|
|
80
|
-
const
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
111
|
+
const steering = (input.right ? 1 : 0) - (input.left ? 1 : 0);
|
|
112
|
+
const drift = nextDrift(pose.drift, input.drift === true, steering, speed, params, driftParams);
|
|
113
|
+
let turn;
|
|
114
|
+
if (drift !== 0 && driftParams) {
|
|
115
|
+
const into = steering * drift;
|
|
116
|
+
turn = drift * (driftParams.turnRate + into * driftParams.steerRate) * params.turnRate;
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
const authority = Math.min(1, (Math.abs(speed) / Math.max(1, params.moveSpeed)) * 3);
|
|
120
|
+
turn = steering * Math.sign(speed) * authority * params.turnRate;
|
|
121
|
+
}
|
|
122
|
+
const heading = turn === 0 ? pose.heading : wrapDeg(pose.heading + turn * dt);
|
|
123
|
+
const slip = nextSlip(pose.slip, drift, steering, dt, driftParams ?? DEFAULT_DRIFT);
|
|
124
|
+
if (speed === 0 &&
|
|
125
|
+
heading === pose.heading &&
|
|
126
|
+
steering === pose.steering &&
|
|
127
|
+
slip === pose.slip &&
|
|
128
|
+
drift === pose.drift) {
|
|
86
129
|
return pose.moving || pose.speed !== 0 ? { ...pose, speed: 0, moving: false } : pose;
|
|
87
130
|
}
|
|
88
131
|
const dir = headingVector(heading);
|
|
@@ -92,6 +135,44 @@ export function stepCharacter(pose, input, dt, scheme, params, cameraRotation =
|
|
|
92
135
|
heading,
|
|
93
136
|
speed,
|
|
94
137
|
moving: speed !== 0,
|
|
138
|
+
steering,
|
|
139
|
+
slip,
|
|
140
|
+
drift,
|
|
95
141
|
};
|
|
96
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* Keep a step from `prev` to `next` on climbable ground: moving onto ground more than
|
|
145
|
+
* `maxStep` higher than where the character stands is blocked. A blocked move first
|
|
146
|
+
* tries to slide along the cliff (keep only the x or only the y part), so walking into
|
|
147
|
+
* a wall at an angle glides along it; failing both, the character stays put (a
|
|
148
|
+
* vehicle also loses its speed, as if it bumped the wall). The heading still turns.
|
|
149
|
+
*/
|
|
150
|
+
export function constrainToGround(prev, next, heightAt, maxStep) {
|
|
151
|
+
if (next.x === prev.x && next.y === prev.y)
|
|
152
|
+
return next;
|
|
153
|
+
const limit = heightAt(prev.x, prev.y) + Math.max(0, maxStep);
|
|
154
|
+
const ok = (x, y) => heightAt(x, y) <= limit;
|
|
155
|
+
if (ok(next.x, next.y))
|
|
156
|
+
return next;
|
|
157
|
+
if (next.x !== prev.x && ok(next.x, prev.y))
|
|
158
|
+
return { ...next, y: prev.y };
|
|
159
|
+
if (next.y !== prev.y && ok(prev.x, next.y))
|
|
160
|
+
return { ...next, x: prev.x };
|
|
161
|
+
return { ...next, x: prev.x, y: prev.y, speed: 0, moving: false };
|
|
162
|
+
}
|
|
163
|
+
function nextDrift(current, held, steering, speed, params, driftParams) {
|
|
164
|
+
// Drifts only run forward: a stopped car never spins in place, whatever the tuning.
|
|
165
|
+
if (!driftParams || !held || speed <= 0)
|
|
166
|
+
return 0;
|
|
167
|
+
if (current !== 0)
|
|
168
|
+
return speed < driftParams.stopSpeed * params.moveSpeed ? 0 : current;
|
|
169
|
+
if (steering === 0 || speed < driftParams.startSpeed * params.moveSpeed)
|
|
170
|
+
return 0;
|
|
171
|
+
return steering > 0 ? 1 : -1;
|
|
172
|
+
}
|
|
173
|
+
function nextSlip(slip, drift, steering, dt, driftParams) {
|
|
174
|
+
const target = drift * (driftParams.slipAngle + Math.max(0, steering * drift) * driftParams.steerSlipAngle);
|
|
175
|
+
const next = slip + (target - slip) * (1 - Math.exp(-driftParams.recoveryRate * dt));
|
|
176
|
+
return Math.abs(next - target) < 0.001 ? target : next;
|
|
177
|
+
}
|
|
97
178
|
//# sourceMappingURL=character-physics.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"character-physics.js","sourceRoot":"","sources":["../src/character-physics.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,oFAAoF;AACpF,kFAAkF;AAClF,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"character-physics.js","sourceRoot":"","sources":["../src/character-physics.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,oFAAoF;AACpF,kFAAkF;AAClF,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAcpE,MAAM,CAAC,MAAM,QAAQ,GAAc;IAClC,EAAE,EAAE,KAAK;IACT,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,KAAK,EAAE,KAAK;IACZ,KAAK,EAAE,KAAK;CACZ,CAAC;AAuBF,+CAA+C;AAC/C,MAAM,CAAC,MAAM,WAAW,GAAkB;IACzC,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,OAAO,EAAE,CAAC;IACV,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,KAAK;IACb,QAAQ,EAAE,CAAC;IACX,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;CACR,CAAC;AAkBF,MAAM,CAAC,MAAM,cAAc,GAAiB;IAC3C,SAAS,EAAE,GAAG;IACd,QAAQ,EAAE,GAAG;IACb,YAAY,EAAE,GAAG;IACjB,QAAQ,EAAE,GAAG;IACb,YAAY,EAAE,GAAG;IACjB,OAAO,EAAE,EAAE;CACX,CAAC;AA4BF,MAAM,CAAC,MAAM,aAAa,GAAgB;IACzC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CAAC,SAAS;QAAE,OAAO,CAAC,CAAC;IAClF,OAAO,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9B,CAAC;AAED,SAAS,QAAQ,CAChB,IAAY,EACZ,KAAiB,EACjB,QAAgB,EAChB,EAAU,EACV,WAAwB;IAExB,MAAM,MAAM,GACX,KAAK,GAAG,CAAC,WAAW,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC,GAAG,WAAW,CAAC,cAAc,CAAC,CAAC;IAC9F,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,YAAY,GAAG,EAAE,CAAC,CAAC,CAAC;IACrF,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AACxD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"character-runtime.d.ts","sourceRoot":"","sources":["../src/character-runtime.tsx"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"character-runtime.d.ts","sourceRoot":"","sources":["../src/character-runtime.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEN,KAAK,aAAa,EAClB,KAAK,KAAK,EAIV,MAAM,uBAAuB,CAAC;AAa/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EACN,KAAK,kBAAkB,EAIvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,aAAa,EAAmB,MAAM,sBAAsB,CAAC;AAE3E,eAAO,MAAM,kBAAkB,cAAc,CAAC;AAG9C,sFAAsF;AACtF,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAe9C;;;;GAIG;AACH,wBAAgB,UAAU,IAAI;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAkB9D;AAED,MAAM,WAAW,uBAAuB;IACvC,IAAI,EAAE,aAAa,CAAC;IACpB,SAAS,CAAC,EAAE,kBAAkB,CAAC;CAC/B;AAED,MAAM,WAAW,gBAAgB;IAChC,qEAAqE;IACrE,aAAa,IAAI,IAAI,CAAC;IACtB,iFAAiF;IACjF,WAAW,IAAI,KAAK,CAAC;IACrB,OAAO,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,CAAC;IACnC,OAAO,IAAI,IAAI,CAAC;CAChB;AAED,wBAAgB,qBAAqB,CACpC,GAAG,EAAE,aAAa,EAClB,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,uBAAuB,GAC9B,gBAAgB,CA8KlB"}
|