@threenative/physics 0.3.11 → 0.3.13

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.
@@ -1,4 +1,4 @@
1
1
  import '@threenative/core';
2
2
  import 'recast-navigation';
3
- export { a7 as INavigationAgent3DOptions, a8 as INavigationContext, a9 as INavigationObstacle3DOptions, aa as INavigationRegion3DOptions, ab as NavigationAgent3D, ac as NavigationAgentEvent, ad as NavigationAgentHandler, ae as NavigationObstacle3D, af as NavigationPlugin, ag as NavigationRegion3D, ah as recast } from '../Area3D-AgKEDg0q.js';
3
+ export { a7 as INavigationAgent3DOptions, a8 as INavigationContext, a9 as INavigationObstacle3DOptions, aa as INavigationRegion3DOptions, ab as NavigationAgent3D, ac as NavigationAgentEvent, ad as NavigationAgentHandler, ae as NavigationObstacle3D, af as NavigationPlugin, ag as NavigationRegion3D, ah as recast } from '../Area3D-CyRWumWF.js';
4
4
  import 'three';
@@ -620,19 +620,28 @@ function disposeNavigation(navigation) {
620
620
  function recast() {
621
621
  let navigation;
622
622
  return {
623
- setup: async (ctx) => {
624
- await initialize();
625
- if (ctx.physics === void 0)
623
+ // Like rapier(), Recast initializes while the scene loads and holds `enter()` until it is up.
624
+ setup: (ctx, runtime) => {
625
+ const physics = Reflect.get(
626
+ ctx,
627
+ /* @__PURE__ */ Symbol.for("threenative.physics.ready")
628
+ );
629
+ if (physics === void 0)
626
630
  throw new Error("recast() requires rapier() earlier in the plugins array.");
627
- const empty = emptyNavigation();
628
- navigation = {
629
- agents: /* @__PURE__ */ new Set(),
630
- navMesh: empty.navMesh,
631
- obstacles: /* @__PURE__ */ new Set(),
632
- query: empty.query,
633
- regions: /* @__PURE__ */ new Set()
634
- };
635
- ctx.physics.navigation = navigation;
631
+ const ready = Promise.all([physics, initialize()]).then(([context]) => {
632
+ if (context === void 0) return;
633
+ const empty = emptyNavigation();
634
+ navigation = {
635
+ agents: /* @__PURE__ */ new Set(),
636
+ navMesh: empty.navMesh,
637
+ obstacles: /* @__PURE__ */ new Set(),
638
+ query: empty.query,
639
+ regions: /* @__PURE__ */ new Set()
640
+ };
641
+ context.navigation = navigation;
642
+ });
643
+ if (runtime?.holdStart === void 0) return ready.then(() => void 0);
644
+ void runtime.holdStart(ready).catch(() => void 0);
636
645
  return void 0;
637
646
  },
638
647
  update: (ctx, dt) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threenative/physics",
3
- "version": "0.3.11",
3
+ "version": "0.3.13",
4
4
  "license": "MIT",
5
5
  "description": "Thin Rapier physics bindings for ThreeNative games.",
6
6
  "keywords": [
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "repository": {
20
20
  "type": "git",
21
- "url": "git+https://github.com/ThreeNativeHQ/threenative.git",
21
+ "url": "git+https://github.com/ThreeNativeHQ/threenative-engine.git",
22
22
  "directory": "packages/physics"
23
23
  },
24
24
  "type": "module",
@@ -55,7 +55,7 @@
55
55
  "recast-navigation": "0.43.1"
56
56
  },
57
57
  "peerDependencies": {
58
- "@threenative/core": ">=0.3.11 <0.4.0",
58
+ "@threenative/core": ">=0.3.13 <0.4.0",
59
59
  "three": ">=0.187.0 <0.188.0"
60
60
  },
61
61
  "devDependencies": {
@@ -65,7 +65,7 @@
65
65
  "tsup": "8.5.1",
66
66
  "typescript": "npm:@typescript/typescript6@6.0.2",
67
67
  "@typescript/native": "npm:typescript@7.0.2",
68
- "@threenative/core": "0.3.11"
68
+ "@threenative/core": "0.3.13"
69
69
  },
70
70
  "scripts": {
71
71
  "build": "tsup --config tsup.config.ts && publint",