incanto 0.10.0 → 0.11.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/dist/3d.d.ts +14 -0
- package/dist/3d.js +3 -3
- package/dist/{create-game-Cq0Z41EQ.js → create-game-DZ_4Nfq8.js} +2 -2
- package/dist/index.js +1 -1
- package/dist/{physics-3d-D8m2Hd-q.js → physics-3d-Br97Ans2.js} +33 -1
- package/dist/react.js +1 -1
- package/dist/{register-BP-kbijm.js → register-ysLR3WQS.js} +5 -1
- package/dist/test.js +3 -3
- package/editor/assets/{agent8--Cd_2Y95.js → agent8-BxNvAcLA.js} +1 -1
- package/editor/assets/{index-Dp_cYQx1.js → index-DMCQXowF.js} +45 -45
- package/editor/index.html +1 -1
- package/package.json +1 -1
- package/skills/incanto-3d-character.md +8 -3
- package/skills/incanto-physics-and-input.md +8 -0
package/dist/3d.d.ts
CHANGED
|
@@ -311,6 +311,20 @@ declare class Physics3D {
|
|
|
311
311
|
normal: [number, number, number];
|
|
312
312
|
node: PhysicsBody3D | null;
|
|
313
313
|
} | null;
|
|
314
|
+
/**
|
|
315
|
+
* Sweep a sphere of `radius` from `origin` along `dir` — a THICK ray. The
|
|
316
|
+
* spring-arm camera probe uses this instead of `castRay`: a thin ray that
|
|
317
|
+
* skims 10 cm over a wall reports "clear" while the camera's near plane
|
|
318
|
+
* still clips the wall; the ball's radius covers that band. Same filters
|
|
319
|
+
* as `castRay` (sensors never hit; `staticOnly` ignores dynamic/kinematic).
|
|
320
|
+
* Returns the travel distance of the sphere CENTER, or null when clear.
|
|
321
|
+
*/
|
|
322
|
+
castSphere(origin: [number, number, number], dir: [number, number, number], radius: number, maxLen: number, exclude?: PhysicsBody3D, opts?: {
|
|
323
|
+
staticOnly?: boolean;
|
|
324
|
+
}): {
|
|
325
|
+
distance: number;
|
|
326
|
+
node: PhysicsBody3D | null;
|
|
327
|
+
} | null;
|
|
314
328
|
}
|
|
315
329
|
//#endregion
|
|
316
330
|
//#region src/3d/create-game.d.ts
|
package/dist/3d.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as Environment3D, c as sunDirectionFromElevationAzimuth, i as syncTree, l as sunDirectionFromSky, o as horizonColorFromSky, r as Renderer3D, s as parseEnvironment3D, t as createGame3D, u as AssetStore3D } from "./create-game-
|
|
2
|
-
import { A as PhysicsBody3D, C as Terrain3D, D as Joint3D, E as terrainThemeLayers, F as QUARTER_PITCH, I as cameraRelative, L as keyboardIntensity, M as StaticBody3D, N as Node3D, O as Area3D, R as movementState, S as Billboard3D, T as TERRAIN_THEMES, _ as resolveFlowerDensity, a as VoxelGrid3D, b as Camera3D, c as Particles3D, d as MeshInstance3D, f as DirectionalLight3D, g as Flowers3D, h as DENSITY_PRESETS, i as VOXEL_PALETTE, j as RigidBody3D, k as CharacterBody3D, l as ModelInstance3D, m as Foliage3D, n as Water3D, o as Tree3D, p as OmniLight3D, r as WATER_MAX_RIPPLES, s as Trail3D, t as registerNodes3D, u as LoftMesh3D, v as FLOWER_VARIETIES, w as DEFAULT_TERRAIN_TEXTURE_BASE, x as BoneAttachment3D, y as CharacterController3D, z as rigPose } from "./register-
|
|
1
|
+
import { a as Environment3D, c as sunDirectionFromElevationAzimuth, i as syncTree, l as sunDirectionFromSky, o as horizonColorFromSky, r as Renderer3D, s as parseEnvironment3D, t as createGame3D, u as AssetStore3D } from "./create-game-DZ_4Nfq8.js";
|
|
2
|
+
import { A as PhysicsBody3D, C as Terrain3D, D as Joint3D, E as terrainThemeLayers, F as QUARTER_PITCH, I as cameraRelative, L as keyboardIntensity, M as StaticBody3D, N as Node3D, O as Area3D, R as movementState, S as Billboard3D, T as TERRAIN_THEMES, _ as resolveFlowerDensity, a as VoxelGrid3D, b as Camera3D, c as Particles3D, d as MeshInstance3D, f as DirectionalLight3D, g as Flowers3D, h as DENSITY_PRESETS, i as VOXEL_PALETTE, j as RigidBody3D, k as CharacterBody3D, l as ModelInstance3D, m as Foliage3D, n as Water3D, o as Tree3D, p as OmniLight3D, r as WATER_MAX_RIPPLES, s as Trail3D, t as registerNodes3D, u as LoftMesh3D, v as FLOWER_VARIETIES, w as DEFAULT_TERRAIN_TEXTURE_BASE, x as BoneAttachment3D, y as CharacterController3D, z as rigPose } from "./register-ysLR3WQS.js";
|
|
3
3
|
import { n as splatWeights, t as buildHeightmap } from "./heightmap-CroQPEER.js";
|
|
4
|
-
import { n as enablePhysics3D, t as Physics3D } from "./physics-3d-
|
|
4
|
+
import { n as enablePhysics3D, t as Physics3D } from "./physics-3d-Br97Ans2.js";
|
|
5
5
|
export { Area3D, AssetStore3D, Billboard3D, BoneAttachment3D, Camera3D, CharacterBody3D, CharacterController3D, DEFAULT_TERRAIN_TEXTURE_BASE, DirectionalLight3D, Environment3D, DENSITY_PRESETS as FLOWER_DENSITY_PRESETS, FLOWER_VARIETIES, Flowers3D, Foliage3D, Joint3D, LoftMesh3D, MeshInstance3D, ModelInstance3D, Node3D, OmniLight3D, Particles3D, Physics3D, PhysicsBody3D, QUARTER_PITCH, Renderer3D, RigidBody3D, StaticBody3D, TERRAIN_THEMES, Terrain3D, Trail3D, Tree3D, VOXEL_PALETTE, VoxelGrid3D, WATER_MAX_RIPPLES, Water3D, buildHeightmap, cameraRelative, createGame3D, enablePhysics3D, horizonColorFromSky, keyboardIntensity, movementState, parseEnvironment3D, registerNodes3D, resolveFlowerDensity, rigPose, splatWeights, sunDirectionFromElevationAzimuth, sunDirectionFromSky, syncTree, terrainThemeLayers };
|
|
@@ -5,8 +5,8 @@ import { t as IncantoError } from "./errors-BpWbnbb_.js";
|
|
|
5
5
|
import { i as resolveRendering, n as attachTouchControls } from "./touch-031PxtCR.js";
|
|
6
6
|
import { n as registerGameplayBehaviors } from "./gameplay-Dn3yidJw.js";
|
|
7
7
|
import { t as debugSources } from "./debug-draw-CZmOYjL2.js";
|
|
8
|
-
import { A as PhysicsBody3D, N as Node3D, b as Camera3D, f as DirectionalLight3D, l as ModelInstance3D, t as registerNodes3D } from "./register-
|
|
9
|
-
import { n as enablePhysics3D } from "./physics-3d-
|
|
8
|
+
import { A as PhysicsBody3D, N as Node3D, b as Camera3D, f as DirectionalLight3D, l as ModelInstance3D, t as registerNodes3D } from "./register-ysLR3WQS.js";
|
|
9
|
+
import { n as enablePhysics3D } from "./physics-3d-Br97Ans2.js";
|
|
10
10
|
import { ACESFilmicToneMapping, AmbientLight, Box3, BufferAttribute, BufferGeometry, Color, DepthTexture, EquirectangularReflectionMapping, FloatType, Fog, HalfFloatType, LineBasicMaterial, LineSegments, Matrix4, Mesh, PCFShadowMap, PMREMGenerator, PerspectiveCamera, PlaneGeometry, Quaternion, Raycaster, Scene, ShaderMaterial, Vector2, Vector3, WebGLRenderTarget, WebGLRenderer } from "three";
|
|
11
11
|
import { VRMLoaderPlugin, VRMUtils } from "@pixiv/three-vrm";
|
|
12
12
|
import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js";
|
package/dist/index.js
CHANGED
|
@@ -295,6 +295,6 @@ function newUid() {
|
|
|
295
295
|
//#endregion
|
|
296
296
|
//#region src/index.ts
|
|
297
297
|
/** Engine version. Kept in sync with package.json by the release pipeline. */
|
|
298
|
-
const VERSION = "0.
|
|
298
|
+
const VERSION = "0.11.0";
|
|
299
299
|
//#endregion
|
|
300
300
|
export { AudioBuses, AudioPlayer, Behavior, CONST_REF_KEY, Engine, HudLayer, IncantoError, InputMap, LogManager, MusicManager, Node, ORDER_GROUP_BASE, PARTICLE_PRESETS, PARTICLE_PRESET_NAMES, ParticleSim, ROLLOFF_MODELS, Rng, SCENE_FORMAT, SFX_PRESETS, SFX_PRESET_NAMES, Scene, SceneTree, SfxEngine, Signal, Timer, TouchControls, UiBanner, UiBar, UiButton, UiDialogue, UiText, VERSION, WebAudioMusicBackend, applyParticlePreset, assetUrls, attachTouchControls, auditScene, clearBehaviors, clearRegistry, computeViewport, createNode, createNoise2D, createSaveStore, crossfadeGains, duplicateNode, effectiveOrder, fadeGain, findPath, getBehavior, getNodeSchema, getNodeSignals, getNodeType, gridFromRows, isAudioContextAvailable, isConstRef, joystickVector, jsonClone, jsonEquals, jsonKind, loadScene, mergeStaticSignals, newUid, parseNodePath, preloadUrls, registerBehavior, registerCoreNodes, registerNode, registeredBehaviors, registeredTypes, replay, resolveConstants, resolveRendering, resolveViewport, serializeNode, spatialGain, spatialPan, startRecording, synthSfx };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import { t as IncantoError } from "./errors-BpWbnbb_.js";
|
|
3
3
|
import { n as registerDebugSource } from "./debug-draw-CZmOYjL2.js";
|
|
4
|
-
import { A as PhysicsBody3D, C as Terrain3D, D as Joint3D, N as Node3D, O as Area3D, P as validateCollider3D, j as RigidBody3D, k as CharacterBody3D } from "./register-
|
|
4
|
+
import { A as PhysicsBody3D, C as Terrain3D, D as Joint3D, N as Node3D, O as Area3D, P as validateCollider3D, j as RigidBody3D, k as CharacterBody3D } from "./register-ysLR3WQS.js";
|
|
5
5
|
import { Euler, Quaternion } from "three";
|
|
6
6
|
//#region src/3d/physics/physics-3d.ts
|
|
7
7
|
var physics_3d_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -399,6 +399,38 @@ var Physics3D = class {
|
|
|
399
399
|
node: this.byColliderHandle.get(hit.collider.handle) ?? null
|
|
400
400
|
};
|
|
401
401
|
}
|
|
402
|
+
/**
|
|
403
|
+
* Sweep a sphere of `radius` from `origin` along `dir` — a THICK ray. The
|
|
404
|
+
* spring-arm camera probe uses this instead of `castRay`: a thin ray that
|
|
405
|
+
* skims 10 cm over a wall reports "clear" while the camera's near plane
|
|
406
|
+
* still clips the wall; the ball's radius covers that band. Same filters
|
|
407
|
+
* as `castRay` (sensors never hit; `staticOnly` ignores dynamic/kinematic).
|
|
408
|
+
* Returns the travel distance of the sphere CENTER, or null when clear.
|
|
409
|
+
*/
|
|
410
|
+
castSphere(origin, dir, radius, maxLen, exclude, opts) {
|
|
411
|
+
const R = this.R;
|
|
412
|
+
const excludeEntry = exclude ? this.entries.get(exclude) : void 0;
|
|
413
|
+
const flags = opts?.staticOnly ? R.QueryFilterFlags.EXCLUDE_DYNAMIC | R.QueryFilterFlags.EXCLUDE_KINEMATIC : void 0;
|
|
414
|
+
const hit = this.world.castShape({
|
|
415
|
+
x: origin[0],
|
|
416
|
+
y: origin[1],
|
|
417
|
+
z: origin[2]
|
|
418
|
+
}, {
|
|
419
|
+
x: 0,
|
|
420
|
+
y: 0,
|
|
421
|
+
z: 0,
|
|
422
|
+
w: 1
|
|
423
|
+
}, {
|
|
424
|
+
x: dir[0],
|
|
425
|
+
y: dir[1],
|
|
426
|
+
z: dir[2]
|
|
427
|
+
}, new R.Ball(radius), 0, maxLen, true, flags, void 0, excludeEntry?.collider, excludeEntry?.body, (collider) => !collider.isSensor());
|
|
428
|
+
if (!hit) return null;
|
|
429
|
+
return {
|
|
430
|
+
distance: hit.time_of_impact,
|
|
431
|
+
node: this.byColliderHandle.get(hit.collider.handle) ?? null
|
|
432
|
+
};
|
|
433
|
+
}
|
|
402
434
|
};
|
|
403
435
|
const quatScratch = new Quaternion();
|
|
404
436
|
const eulerScratch = new Euler();
|
package/dist/react.js
CHANGED
|
@@ -156,7 +156,7 @@ function IncantoCanvas(props) {
|
|
|
156
156
|
pointer: latest.pointer,
|
|
157
157
|
...keyboard !== void 0 ? { keyboard } : {}
|
|
158
158
|
};
|
|
159
|
-
const next = await (_gameFactory ?? (mode === "3d" ? async (o) => (await import("./create-game-
|
|
159
|
+
const next = await (_gameFactory ?? (mode === "3d" ? async (o) => (await import("./create-game-DZ_4Nfq8.js").then((n) => n.n)).createGame3D(o) : async (o) => (await import("./create-game-CdWhP6ve.js").then((n) => n.n)).createGame2D(o)))(opts);
|
|
160
160
|
if (disposed) {
|
|
161
161
|
next.dispose();
|
|
162
162
|
return;
|
|
@@ -2017,6 +2017,10 @@ const CAM_COLLISION_MARGIN = .3;
|
|
|
2017
2017
|
const CAM_COLLISION_MIN_DIST = .4;
|
|
2018
2018
|
/** Ground backstop: keep the camera at least this high above whatever is below it. */
|
|
2019
2019
|
const CAM_GROUND_CLEARANCE = .3;
|
|
2020
|
+
/** Spring-arm probe thickness: a THIN ray that skims 10 cm above a wall reports
|
|
2021
|
+
* "clear" while the wall still fills the frame — the sphere's radius covers the
|
|
2022
|
+
* near-plane band around the boom (the Emberwood hedge-maze lesson). */
|
|
2023
|
+
const CAM_PROBE_RADIUS = .25;
|
|
2020
2024
|
const eulerScratch = new Euler();
|
|
2021
2025
|
const quatScratch = new Quaternion();
|
|
2022
2026
|
const matrixScratch$3 = new Matrix4();
|
|
@@ -2285,7 +2289,7 @@ var CharacterController3D = class extends Node3D {
|
|
|
2285
2289
|
if (this.cameraCollision && this.view !== "firstPerson") {
|
|
2286
2290
|
const physics = body._physics3d;
|
|
2287
2291
|
if (physics) {
|
|
2288
|
-
target = springArmCamera(eye, target, (o, dr, len) => physics.
|
|
2292
|
+
target = springArmCamera(eye, target, (o, dr, len) => physics.castSphere(o, dr, CAM_PROBE_RADIUS, len, body, { staticOnly: true })?.distance ?? null, CAM_COLLISION_MARGIN, CAM_COLLISION_MIN_DIST);
|
|
2289
2293
|
target = clampCameraAboveGround(target, (o, len) => physics.castRay(o, [
|
|
2290
2294
|
0,
|
|
2291
2295
|
-1,
|
package/dist/test.js
CHANGED
|
@@ -6,7 +6,7 @@ import { n as jsonEquals, t as jsonClone } from "./json-BLk7H2Qa.js";
|
|
|
6
6
|
import { i as getNodeSchema, s as mergeStaticProps } from "./registry-BVJ2HbCn.js";
|
|
7
7
|
import { n as registerGameplayBehaviors } from "./gameplay-Dn3yidJw.js";
|
|
8
8
|
import { t as registerNodes2D } from "./register-BD6zgrv_.js";
|
|
9
|
-
import { t as registerNodes3D } from "./register-
|
|
9
|
+
import { t as registerNodes3D } from "./register-ysLR3WQS.js";
|
|
10
10
|
import { t as registerNodesNet } from "./register-Cwc-yCYx.js";
|
|
11
11
|
//#region src/test/index.ts
|
|
12
12
|
/**
|
|
@@ -127,7 +127,7 @@ async function runScript(json, opts) {
|
|
|
127
127
|
const { enablePhysics2D } = await import("./physics-2d-DweTURFt.js").then((n) => n.r);
|
|
128
128
|
await enablePhysics2D(engine);
|
|
129
129
|
} else if (physics === "3d" || physics === "auto" && scene.dimension === "3d") {
|
|
130
|
-
const { enablePhysics3D } = await import("./physics-3d-
|
|
130
|
+
const { enablePhysics3D } = await import("./physics-3d-Br97Ans2.js").then((n) => n.r);
|
|
131
131
|
await enablePhysics3D(engine);
|
|
132
132
|
}
|
|
133
133
|
const failures = [];
|
|
@@ -232,7 +232,7 @@ async function createPlaySession(json, opts = {}) {
|
|
|
232
232
|
const { enablePhysics2D } = await import("./physics-2d-DweTURFt.js").then((n) => n.r);
|
|
233
233
|
await enablePhysics2D(engine);
|
|
234
234
|
} else if (physics === "3d" || physics === "auto" && scene.dimension === "3d") {
|
|
235
|
-
const { enablePhysics3D } = await import("./physics-3d-
|
|
235
|
+
const { enablePhysics3D } = await import("./physics-3d-Br97Ans2.js").then((n) => n.r);
|
|
236
236
|
await enablePhysics3D(engine);
|
|
237
237
|
}
|
|
238
238
|
const stepMs = 1e3 / (opts.fixedHz ?? 60);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./index-
|
|
1
|
+
import{t as e}from"./index-DMCQXowF.js";async function t(t){return new n((await e(()=>import(`./GameServer-C56iOUgF.js`),[],import.meta.url)).GameServer,t)}var n=class{raw;active=new Map;reconnecting=!1;disposed=!1;constructor(e,t){this.raw=new e({...t})}get account(){return this.raw.account}get connected(){return this.raw.connected}connect(){return this.raw.connected?Promise.resolve(!0):(this.disposed=!1,this.rawConnect())}rawConnect(){return this.raw.connect({onDisconnect:()=>void this.reconnect()})}disconnect(){this.disposed=!0;for(let e of this.active.values())e.off();return this.active.clear(),this.raw.disconnect()}remoteFunction(e,t,n){return this.raw.remoteFunction(e,t,n)}track(e){let t=Symbol(`sub`),n={make:e,off:e()};return this.active.set(t,n),()=>{n.off(),this.active.delete(t)}}async reconnect(){if(!this.disposed&&!this.reconnecting){this.reconnecting=!0;try{await this.rawConnect();for(let e of this.active.values())e.off(),e.off=e.make()}finally{this.reconnecting=!1}}}subscribeRoomState(e,t){return this.track(()=>this.raw.subscribeRoomState(e,t))}subscribeRoomMyState(e,t){return this.track(()=>this.raw.subscribeRoomMyState(e,t))}subscribeRoomAllUserStates(e,t){return this.track(()=>this.raw.subscribeRoomAllUserStates(e,e=>{let n={};for(let t of e??[]){if(!t||typeof t.account!=`string`||t.__leaved)continue;let{account:e,__updated:r,__leaved:i,...a}=t;n[e]=a}t(n)}))}subscribeRoomCollection(e,t,n){return this.track(()=>this.raw.subscribeRoomCollection(e,t,({items:e})=>{let t={};for(let n of e??[])n&&typeof n.__id==`string`&&(t[n.__id]=n);n(t)}))}onRoomMessage(e,t,n){return this.track(()=>this.raw.onRoomMessage(e,t,n))}onRoomUserJoin(e,t){return this.track(()=>this.raw.onRoomUserJoin(e,t))}onRoomUserLeave(e,t){return this.track(()=>this.raw.onRoomUserLeave(e,t))}subscribeGlobalState(e){return this.track(()=>this.raw.subscribeGlobalState(e))}subscribeGlobalMyState(e){return this.track(()=>this.raw.subscribeGlobalMyState(e))}subscribeGlobalUserState(e,t){return this.track(()=>this.raw.subscribeGlobalUserState(e,t))}subscribeGlobalCollection(e,t){return this.track(()=>this.raw.subscribeGlobalCollection(e,({items:e})=>{let n={};for(let t of e??[])t&&typeof t.__id==`string`&&(n[t.__id]=t);t(n)}))}subscribeAsset(e,t){return this.track(()=>this.raw.subscribeAsset(e,t))}onGlobalMessage(e,t){return this.track(()=>this.raw.onGlobalMessage(e,t))}};export{t as createAgent8Server};
|