@hology/core 0.0.91 → 0.0.93
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/config/project-config.d.ts +1 -0
- package/dist/config/project-config.d.ts.map +1 -0
- package/dist/config/project-config.js +1 -2
- package/dist/controllers/base-game-controller.d.ts +1 -0
- package/dist/controllers/base-game-controller.d.ts.map +1 -0
- package/dist/controllers/base-game-controller.js +1 -2
- package/dist/csm.d.ts +1 -0
- package/dist/csm.d.ts.map +1 -0
- package/dist/csm.js +1 -2
- package/dist/effects/particles/examples.d.ts +1 -0
- package/dist/effects/particles/examples.d.ts.map +1 -0
- package/dist/effects/particles/examples.js +1 -2
- package/dist/effects/particles/particle-system-config.d.ts +1 -0
- package/dist/effects/particles/particle-system-config.d.ts.map +1 -0
- package/dist/effects/particles/particle-system-config.js +1 -2
- package/dist/effects/vfx/behaviours.d.ts +3 -1
- package/dist/effects/vfx/behaviours.d.ts.map +1 -0
- package/dist/effects/vfx/behaviours.js +1 -2
- package/dist/effects/vfx/index.d.ts +1 -0
- package/dist/effects/vfx/index.d.ts.map +1 -0
- package/dist/effects/vfx/index.js +1 -2
- package/dist/effects/vfx/initializsers.d.ts +20 -39
- package/dist/effects/vfx/initializsers.d.ts.map +1 -0
- package/dist/effects/vfx/initializsers.js +1 -2
- package/dist/effects/vfx/rates.d.ts +5 -4
- package/dist/effects/vfx/rates.d.ts.map +1 -0
- package/dist/effects/vfx/rates.js +1 -2
- package/dist/effects/vfx/stretched-sprite.d.ts +1 -0
- package/dist/effects/vfx/stretched-sprite.d.ts.map +1 -0
- package/dist/effects/vfx/stretched-sprite.js +1 -2
- package/dist/effects/vfx/trail-renderer.d.ts +1 -0
- package/dist/effects/vfx/trail-renderer.d.ts.map +1 -0
- package/dist/effects/vfx/trail-renderer.js +1 -2
- package/dist/effects/vfx/vfx-actor.d.ts +3 -1
- package/dist/effects/vfx/vfx-actor.d.ts.map +1 -0
- package/dist/effects/vfx/vfx-actor.js +1 -2
- package/dist/effects/vfx/vfx-asset.d.ts +14 -0
- package/dist/effects/vfx/vfx-asset.d.ts.map +1 -0
- package/dist/effects/vfx/vfx-asset.js +1 -2
- package/dist/effects/vfx/vfx-collision-behaviour.d.ts +19 -0
- package/dist/effects/vfx/vfx-collision-behaviour.d.ts.map +1 -0
- package/dist/effects/vfx/vfx-collision-behaviour.js +4 -0
- package/dist/effects/vfx/vfx-defs.d.ts +33 -19
- package/dist/effects/vfx/vfx-defs.d.ts.map +1 -0
- package/dist/effects/vfx/vfx-defs.js +1 -2
- package/dist/effects/vfx/vfx-materializer.d.ts +11 -3
- package/dist/effects/vfx/vfx-materializer.d.ts.map +1 -0
- package/dist/effects/vfx/vfx-materializer.js +1 -2
- package/dist/effects/vfx/vfx-old-materializer.d.ts +2 -11
- package/dist/effects/vfx/vfx-old-materializer.d.ts.map +1 -0
- package/dist/effects/vfx/vfx-old-materializer.js +1 -2
- package/dist/effects/vfx/vfx-param.d.ts +1 -0
- package/dist/effects/vfx/vfx-param.d.ts.map +1 -0
- package/dist/effects/vfx/vfx-param.js +1 -2
- package/dist/effects/vfx/vfx-renderers.d.ts +3 -1
- package/dist/effects/vfx/vfx-renderers.d.ts.map +1 -0
- package/dist/effects/vfx/vfx-renderers.js +1 -2
- package/dist/effects/vfx/vfx-service.d.ts +1 -0
- package/dist/effects/vfx/vfx-service.d.ts.map +1 -0
- package/dist/effects/vfx/vfx-service.js +1 -2
- package/dist/effects/vfx/zones.d.ts +2 -1
- package/dist/effects/vfx/zones.d.ts.map +1 -0
- package/dist/effects/vfx/zones.js +1 -2
- package/dist/game-component/component-decorators.d.ts +1 -0
- package/dist/game-component/component-decorators.d.ts.map +1 -0
- package/dist/game-component/component-decorators.js +1 -2
- package/dist/game-component/game-component.d.ts +1 -0
- package/dist/game-component/game-component.d.ts.map +1 -0
- package/dist/game-component/game-component.js +1 -2
- package/dist/gameplay/actors/actor.d.ts +1 -0
- package/dist/gameplay/actors/actor.d.ts.map +1 -0
- package/dist/gameplay/actors/actor.js +1 -2
- package/dist/gameplay/actors/builtin/camera-actor.d.ts +1 -0
- package/dist/gameplay/actors/builtin/camera-actor.d.ts.map +1 -0
- package/dist/gameplay/actors/builtin/camera-actor.js +1 -2
- package/dist/gameplay/actors/builtin/components/character/character-animation.d.ts +1 -0
- package/dist/gameplay/actors/builtin/components/character/character-animation.d.ts.map +1 -0
- package/dist/gameplay/actors/builtin/components/character/character-animation.js +1 -2
- package/dist/gameplay/actors/builtin/components/character/character-movement copy.d.ts +1 -0
- package/dist/gameplay/actors/builtin/components/character/character-movement copy.d.ts.map +1 -0
- package/dist/gameplay/actors/builtin/components/character/character-movement copy.js +1 -2
- package/dist/gameplay/actors/builtin/components/character/character-movement.d.ts +1 -0
- package/dist/gameplay/actors/builtin/components/character/character-movement.d.ts.map +1 -0
- package/dist/gameplay/actors/builtin/components/character/character-movement.js +1 -2
- package/dist/gameplay/actors/builtin/components/character/modes.d.ts +1 -0
- package/dist/gameplay/actors/builtin/components/character/modes.d.ts.map +1 -0
- package/dist/gameplay/actors/builtin/components/character/modes.js +1 -2
- package/dist/gameplay/actors/builtin/components/mesh-component.d.ts +1 -0
- package/dist/gameplay/actors/builtin/components/mesh-component.d.ts.map +1 -0
- package/dist/gameplay/actors/builtin/components/mesh-component.js +1 -2
- package/dist/gameplay/actors/builtin/components/scene-component.d.ts +1 -0
- package/dist/gameplay/actors/builtin/components/scene-component.d.ts.map +1 -0
- package/dist/gameplay/actors/builtin/components/scene-component.js +1 -2
- package/dist/gameplay/actors/builtin/index.d.ts +1 -0
- package/dist/gameplay/actors/builtin/index.d.ts.map +1 -0
- package/dist/gameplay/actors/builtin/index.js +1 -2
- package/dist/gameplay/actors/builtin/navmesh-actor.d.ts +1 -0
- package/dist/gameplay/actors/builtin/navmesh-actor.d.ts.map +1 -0
- package/dist/gameplay/actors/builtin/navmesh-actor.js +1 -2
- package/dist/gameplay/actors/builtin/positional-audio-actor.d.ts +1 -0
- package/dist/gameplay/actors/builtin/positional-audio-actor.d.ts.map +1 -0
- package/dist/gameplay/actors/builtin/positional-audio-actor.js +1 -2
- package/dist/gameplay/actors/builtin/spawn-point.d.ts +1 -0
- package/dist/gameplay/actors/builtin/spawn-point.d.ts.map +1 -0
- package/dist/gameplay/actors/builtin/spawn-point.js +1 -2
- package/dist/gameplay/actors/builtin/trigger-volume.d.ts +1 -0
- package/dist/gameplay/actors/builtin/trigger-volume.d.ts.map +1 -0
- package/dist/gameplay/actors/builtin/trigger-volume.js +1 -2
- package/dist/gameplay/actors/camera/camera-component.d.ts +1 -0
- package/dist/gameplay/actors/camera/camera-component.d.ts.map +1 -0
- package/dist/gameplay/actors/camera/camera-component.js +1 -2
- package/dist/gameplay/actors/camera/third-person-camera-component.d.ts +1 -0
- package/dist/gameplay/actors/camera/third-person-camera-component.d.ts.map +1 -0
- package/dist/gameplay/actors/camera/third-person-camera-component.js +1 -2
- package/dist/gameplay/actors/component.d.ts +1 -0
- package/dist/gameplay/actors/component.d.ts.map +1 -0
- package/dist/gameplay/actors/component.js +1 -2
- package/dist/gameplay/actors/factory.d.ts +1 -0
- package/dist/gameplay/actors/factory.d.ts.map +1 -0
- package/dist/gameplay/actors/factory.js +1 -2
- package/dist/gameplay/actors/index.d.ts +1 -0
- package/dist/gameplay/actors/index.d.ts.map +1 -0
- package/dist/gameplay/actors/index.js +1 -2
- package/dist/gameplay/actors/internal/component-init.d.ts +1 -0
- package/dist/gameplay/actors/internal/component-init.d.ts.map +1 -0
- package/dist/gameplay/actors/internal/component-init.js +1 -2
- package/dist/gameplay/actors/internal/container-map.d.ts +1 -0
- package/dist/gameplay/actors/internal/container-map.d.ts.map +1 -0
- package/dist/gameplay/actors/internal/container-map.js +1 -2
- package/dist/gameplay/ai/behavior-tree/bt.d.ts +1 -0
- package/dist/gameplay/ai/behavior-tree/bt.d.ts.map +1 -0
- package/dist/gameplay/ai/behavior-tree/bt.js +1 -2
- package/dist/gameplay/ai/behavior-tree/move.d.ts +1 -0
- package/dist/gameplay/ai/behavior-tree/move.d.ts.map +1 -0
- package/dist/gameplay/ai/behavior-tree/move.js +1 -2
- package/dist/gameplay/ai/build-tile.d.ts +2 -1
- package/dist/gameplay/ai/build-tile.d.ts.map +1 -0
- package/dist/gameplay/ai/build-tile.js +1 -2
- package/dist/gameplay/ai/dynamic-tiled-navmesh.d.ts +1 -0
- package/dist/gameplay/ai/dynamic-tiled-navmesh.d.ts.map +1 -0
- package/dist/gameplay/ai/dynamic-tiled-navmesh.js +1 -2
- package/dist/gameplay/ai/dynamic-tiled-navmesh.worker.d.ts +1 -0
- package/dist/gameplay/ai/dynamic-tiled-navmesh.worker.d.ts.map +1 -0
- package/dist/gameplay/ai/dynamic-tiled-navmesh.worker.js +1 -2
- package/dist/gameplay/ai/index.d.ts +1 -0
- package/dist/gameplay/ai/index.d.ts.map +1 -0
- package/dist/gameplay/ai/index.js +1 -2
- package/dist/gameplay/ai/navigation.d.ts +1 -0
- package/dist/gameplay/ai/navigation.d.ts.map +1 -0
- package/dist/gameplay/ai/navigation.js +1 -2
- package/dist/gameplay/animation/anim-sm.d.ts +1 -0
- package/dist/gameplay/animation/anim-sm.d.ts.map +1 -0
- package/dist/gameplay/animation/anim-sm.js +1 -2
- package/dist/gameplay/animation/root-motion.d.ts +1 -0
- package/dist/gameplay/animation/root-motion.d.ts.map +1 -0
- package/dist/gameplay/animation/root-motion.js +1 -2
- package/dist/gameplay/env.d.ts +1 -0
- package/dist/gameplay/env.d.ts.map +1 -0
- package/dist/gameplay/env.js +1 -2
- package/dist/gameplay/index.d.ts +1 -0
- package/dist/gameplay/index.d.ts.map +1 -0
- package/dist/gameplay/index.js +1 -2
- package/dist/gameplay/initiate.d.ts +1 -0
- package/dist/gameplay/initiate.d.ts.map +1 -0
- package/dist/gameplay/initiate.js +1 -2
- package/dist/gameplay/inject.d.ts +1 -0
- package/dist/gameplay/inject.d.ts.map +1 -0
- package/dist/gameplay/inject.js +1 -2
- package/dist/gameplay/input/index.d.ts +1 -0
- package/dist/gameplay/input/index.d.ts.map +1 -0
- package/dist/gameplay/input/index.js +1 -2
- package/dist/gameplay/input/input-service.d.ts +1 -0
- package/dist/gameplay/input/input-service.d.ts.map +1 -0
- package/dist/gameplay/input/input-service.js +1 -2
- package/dist/gameplay/input/input.d.ts +1 -0
- package/dist/gameplay/input/input.d.ts.map +1 -0
- package/dist/gameplay/input/input.js +1 -2
- package/dist/gameplay/input/keybind.d.ts +1 -0
- package/dist/gameplay/input/keybind.d.ts.map +1 -0
- package/dist/gameplay/input/keybind.js +1 -2
- package/dist/gameplay/polyfill.d.ts +1 -0
- package/dist/gameplay/polyfill.d.ts.map +1 -0
- package/dist/gameplay/polyfill.js +1 -2
- package/dist/gameplay/services/asset-loader.d.ts +1 -0
- package/dist/gameplay/services/asset-loader.d.ts.map +1 -0
- package/dist/gameplay/services/asset-loader.js +1 -2
- package/dist/gameplay/services/physics/abstract-physics-system.d.ts +1 -0
- package/dist/gameplay/services/physics/abstract-physics-system.d.ts.map +1 -0
- package/dist/gameplay/services/physics/abstract-physics-system.js +1 -2
- package/dist/gameplay/services/physics/collision-contact.d.ts +1 -0
- package/dist/gameplay/services/physics/collision-contact.d.ts.map +1 -0
- package/dist/gameplay/services/physics/collision-contact.js +1 -2
- package/dist/gameplay/services/physics/physics-system.d.ts +1 -0
- package/dist/gameplay/services/physics/physics-system.d.ts.map +1 -0
- package/dist/gameplay/services/physics/physics-system.js +1 -2
- package/dist/gameplay/services/pointer-events.d.ts +1 -0
- package/dist/gameplay/services/pointer-events.d.ts.map +1 -0
- package/dist/gameplay/services/pointer-events.js +1 -2
- package/dist/gameplay/services/render.d.ts +1 -0
- package/dist/gameplay/services/render.d.ts.map +1 -0
- package/dist/gameplay/services/render.js +1 -2
- package/dist/gameplay/services/world.d.ts +1 -0
- package/dist/gameplay/services/world.d.ts.map +1 -0
- package/dist/gameplay/services/world.js +1 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -2
- package/dist/rendering/shader-override.d.ts +1 -0
- package/dist/rendering/shader-override.d.ts.map +1 -0
- package/dist/rendering/shader-override.js +1 -2
- package/dist/rendering.d.ts +1 -0
- package/dist/rendering.d.ts.map +1 -0
- package/dist/rendering.js +1 -2
- package/dist/scene/asset-resource-loader.d.ts +1 -0
- package/dist/scene/asset-resource-loader.d.ts.map +1 -0
- package/dist/scene/asset-resource-loader.js +1 -2
- package/dist/scene/assets-provider.d.ts +1 -0
- package/dist/scene/assets-provider.d.ts.map +1 -0
- package/dist/scene/assets-provider.js +1 -2
- package/dist/scene/bootstrap.d.ts +1 -0
- package/dist/scene/bootstrap.d.ts.map +1 -0
- package/dist/scene/bootstrap.js +1 -2
- package/dist/scene/collision/collision-shape-import.d.ts +1 -0
- package/dist/scene/collision/collision-shape-import.d.ts.map +1 -0
- package/dist/scene/collision/collision-shape-import.js +1 -2
- package/dist/scene/collision/collision-shape.d.ts +1 -0
- package/dist/scene/collision/collision-shape.d.ts.map +1 -0
- package/dist/scene/collision/collision-shape.js +1 -2
- package/dist/scene/landscape/landscape-manager.d.ts +1 -0
- package/dist/scene/landscape/landscape-manager.d.ts.map +1 -0
- package/dist/scene/landscape/landscape-manager.js +1 -2
- package/dist/scene/landscape/landscape.d.ts +1 -0
- package/dist/scene/landscape/landscape.d.ts.map +1 -0
- package/dist/scene/landscape/landscape.js +1 -2
- package/dist/scene/landscape/utils.d.ts +1 -0
- package/dist/scene/landscape/utils.d.ts.map +1 -0
- package/dist/scene/landscape/utils.js +1 -2
- package/dist/scene/materializer.d.ts +1 -0
- package/dist/scene/materializer.d.ts.map +1 -0
- package/dist/scene/materializer.js +1 -2
- package/dist/scene/materials/grass-foliage.d.ts +1 -0
- package/dist/scene/materials/grass-foliage.d.ts.map +1 -0
- package/dist/scene/materials/grass-foliage.js +1 -2
- package/dist/scene/materials/grass.d.ts +1 -0
- package/dist/scene/materials/grass.d.ts.map +1 -0
- package/dist/scene/materials/grass.js +1 -2
- package/dist/scene/materials/utils/material-painting.d.ts +1 -0
- package/dist/scene/materials/utils/material-painting.d.ts.map +1 -0
- package/dist/scene/materials/utils/material-painting.js +1 -2
- package/dist/scene/materials/utils/noise.glsl.d.ts +1 -0
- package/dist/scene/materials/utils/noise.glsl.d.ts.map +1 -0
- package/dist/scene/materials/utils/noise.glsl.js +1 -2
- package/dist/scene/materials/water.d.ts +1 -0
- package/dist/scene/materials/water.d.ts.map +1 -0
- package/dist/scene/materials/water.js +1 -2
- package/dist/scene/model.d.ts +3 -1
- package/dist/scene/model.d.ts.map +1 -0
- package/dist/scene/model.js +1 -2
- package/dist/scene/objects/ramp-geometry.d.ts +1 -0
- package/dist/scene/objects/ramp-geometry.d.ts.map +1 -0
- package/dist/scene/objects/ramp-geometry.js +1 -2
- package/dist/scene/objects/shapes.d.ts +3 -3
- package/dist/scene/objects/shapes.d.ts.map +1 -0
- package/dist/scene/objects/shapes.js +1 -2
- package/dist/scene/objects/stairs-geometry.d.ts +1 -0
- package/dist/scene/objects/stairs-geometry.d.ts.map +1 -0
- package/dist/scene/objects/stairs-geometry.js +1 -2
- package/dist/scene/runtime-asset-service.d.ts +1 -0
- package/dist/scene/runtime-asset-service.d.ts.map +1 -0
- package/dist/scene/runtime-asset-service.js +1 -2
- package/dist/scene/runtime-backend-service.d.ts +1 -0
- package/dist/scene/runtime-backend-service.d.ts.map +1 -0
- package/dist/scene/runtime-backend-service.js +1 -2
- package/dist/scene/runtime-bundled-backend-service.d.ts +1 -0
- package/dist/scene/runtime-bundled-backend-service.d.ts.map +1 -0
- package/dist/scene/runtime-bundled-backend-service.js +1 -2
- package/dist/scene/scene-data-service.d.ts +1 -0
- package/dist/scene/scene-data-service.d.ts.map +1 -0
- package/dist/scene/scene-data-service.js +1 -2
- package/dist/scene/sky.d.ts +1 -0
- package/dist/scene/sky.d.ts.map +1 -0
- package/dist/scene/sky.js +1 -2
- package/dist/scene/storage/storage.d.ts +1 -0
- package/dist/scene/storage/storage.d.ts.map +1 -0
- package/dist/scene/storage/storage.js +1 -2
- package/dist/shader/builtin/index.d.ts +1 -0
- package/dist/shader/builtin/index.d.ts.map +1 -0
- package/dist/shader/builtin/index.js +1 -2
- package/dist/shader/builtin/lambert-shader.d.ts +1 -0
- package/dist/shader/builtin/lambert-shader.d.ts.map +1 -0
- package/dist/shader/builtin/lambert-shader.js +1 -2
- package/dist/shader/builtin/landscape-composite-shader.d.ts +1 -0
- package/dist/shader/builtin/landscape-composite-shader.d.ts.map +1 -0
- package/dist/shader/builtin/landscape-composite-shader.js +1 -2
- package/dist/shader/builtin/landscape-shader.d.ts +1 -0
- package/dist/shader/builtin/landscape-shader.d.ts.map +1 -0
- package/dist/shader/builtin/landscape-shader.js +1 -2
- package/dist/shader/builtin/standard-shader.d.ts +1 -0
- package/dist/shader/builtin/standard-shader.d.ts.map +1 -0
- package/dist/shader/builtin/standard-shader.js +1 -2
- package/dist/shader/builtin/unlit-shader.d.ts +1 -0
- package/dist/shader/builtin/unlit-shader.d.ts.map +1 -0
- package/dist/shader/builtin/unlit-shader.js +1 -2
- package/dist/shader/index.d.ts +1 -0
- package/dist/shader/index.d.ts.map +1 -0
- package/dist/shader/index.js +1 -2
- package/dist/shader/parameter.d.ts +3 -1
- package/dist/shader/parameter.d.ts.map +1 -0
- package/dist/shader/parameter.js +1 -2
- package/dist/shader/shader.d.ts +1 -0
- package/dist/shader/shader.d.ts.map +1 -0
- package/dist/shader/shader.js +1 -2
- package/dist/shader-nodes/bulge.d.ts +1 -0
- package/dist/shader-nodes/bulge.d.ts.map +1 -0
- package/dist/shader-nodes/bulge.js +1 -2
- package/dist/shader-nodes/depth.d.ts +1 -0
- package/dist/shader-nodes/depth.d.ts.map +1 -0
- package/dist/shader-nodes/depth.js +1 -2
- package/dist/shader-nodes/effects.d.ts +1 -0
- package/dist/shader-nodes/effects.d.ts.map +1 -0
- package/dist/shader-nodes/effects.js +1 -2
- package/dist/shader-nodes/glsl-node.d.ts +2 -1
- package/dist/shader-nodes/glsl-node.d.ts.map +1 -0
- package/dist/shader-nodes/glsl-node.js +1 -2
- package/dist/shader-nodes/index.d.ts +2 -0
- package/dist/shader-nodes/index.d.ts.map +1 -0
- package/dist/shader-nodes/index.js +1 -2
- package/dist/shader-nodes/landscape.d.ts +1 -0
- package/dist/shader-nodes/landscape.d.ts.map +1 -0
- package/dist/shader-nodes/landscape.js +1 -2
- package/dist/shader-nodes/layers.d.ts +1 -0
- package/dist/shader-nodes/layers.d.ts.map +1 -0
- package/dist/shader-nodes/layers.js +1 -2
- package/dist/shader-nodes/math.d.ts +1 -0
- package/dist/shader-nodes/math.d.ts.map +1 -0
- package/dist/shader-nodes/math.js +1 -2
- package/dist/shader-nodes/particle.d.ts +3 -0
- package/dist/shader-nodes/particle.d.ts.map +1 -0
- package/dist/shader-nodes/particle.js +1 -2
- package/dist/shader-nodes/shapes.d.ts +1 -0
- package/dist/shader-nodes/shapes.d.ts.map +1 -0
- package/dist/shader-nodes/shapes.js +1 -2
- package/dist/shader-nodes/texture-sequence.d.ts +2 -1
- package/dist/shader-nodes/texture-sequence.d.ts.map +1 -0
- package/dist/shader-nodes/texture-sequence.js +1 -2
- package/dist/shader-nodes/time.d.ts +1 -0
- package/dist/shader-nodes/time.d.ts.map +1 -0
- package/dist/shader-nodes/time.js +1 -2
- package/dist/shader-nodes/voronoi.d.ts +1 -0
- package/dist/shader-nodes/voronoi.d.ts.map +1 -0
- package/dist/shader-nodes/voronoi.js +1 -2
- package/dist/test/injection.test.d.ts +1 -0
- package/dist/test/injection.test.d.ts.map +1 -0
- package/dist/test/injection.test.js +1 -2
- package/dist/utils/async.d.ts +1 -0
- package/dist/utils/async.d.ts.map +1 -0
- package/dist/utils/async.js +1 -2
- package/dist/utils/buffer.d.ts +1 -0
- package/dist/utils/buffer.d.ts.map +1 -0
- package/dist/utils/buffer.js +1 -2
- package/dist/utils/collections.d.ts +1 -0
- package/dist/utils/collections.d.ts.map +1 -0
- package/dist/utils/collections.js +1 -2
- package/dist/utils/curve.d.ts +12 -0
- package/dist/utils/curve.d.ts.map +1 -0
- package/dist/utils/curve.js +4 -0
- package/dist/utils/files.d.ts +1 -0
- package/dist/utils/files.d.ts.map +1 -0
- package/dist/utils/files.js +1 -2
- package/dist/utils/materials.d.ts +1 -0
- package/dist/utils/materials.d.ts.map +1 -0
- package/dist/utils/materials.js +1 -2
- package/dist/utils/math.d.ts +1 -0
- package/dist/utils/math.d.ts.map +1 -0
- package/dist/utils/math.js +1 -2
- package/dist/utils/mesh.d.ts +1 -0
- package/dist/utils/mesh.d.ts.map +1 -0
- package/dist/utils/mesh.js +1 -2
- package/dist/utils/polyfill.d.ts +1 -0
- package/dist/utils/polyfill.d.ts.map +1 -0
- package/dist/utils/polyfill.js +1 -2
- package/dist/utils/three/depth-pass.d.ts +1 -0
- package/dist/utils/three/depth-pass.d.ts.map +1 -0
- package/dist/utils/three/depth-pass.js +1 -2
- package/dist/utils/three/gpu-stats-panel.d.ts +1 -0
- package/dist/utils/three/gpu-stats-panel.d.ts.map +1 -0
- package/dist/utils/three/gpu-stats-panel.js +1 -2
- package/dist/utils/three/line-sphere.d.ts +1 -0
- package/dist/utils/three/line-sphere.d.ts.map +1 -0
- package/dist/utils/three/line-sphere.js +1 -2
- package/dist/utils/three/outline-pass.d.ts +1 -0
- package/dist/utils/three/outline-pass.d.ts.map +1 -0
- package/dist/utils/three/outline-pass.js +1 -2
- package/dist/utils/three/positional-audio-helper.d.ts +1 -0
- package/dist/utils/three/positional-audio-helper.d.ts.map +1 -0
- package/dist/utils/three/positional-audio-helper.js +1 -2
- package/dist/utils/three/stats.d.ts +1 -0
- package/dist/utils/three/stats.d.ts.map +1 -0
- package/dist/utils/three/stats.js +1 -2
- package/dist/utils/three/transform-controls.d.ts +1 -0
- package/dist/utils/three/transform-controls.d.ts.map +1 -0
- package/dist/utils/three/transform-controls.js +1 -2
- package/dist/utils/three/traverse.d.ts +1 -0
- package/dist/utils/three/traverse.d.ts.map +1 -0
- package/dist/utils/three/traverse.js +1 -2
- package/dist/utils/type.d.ts +1 -0
- package/dist/utils/type.d.ts.map +1 -0
- package/dist/utils/type.js +1 -2
- package/dist/utils/uuid.d.ts +1 -0
- package/dist/utils/uuid.d.ts.map +1 -0
- package/dist/utils/uuid.js +1 -2
- package/dist/utils/voxel-bitset.d.ts +14 -0
- package/dist/utils/voxel-bitset.d.ts.map +1 -0
- package/dist/utils/voxel-bitset.js +4 -0
- package/dist/worker/index.d.ts +1 -0
- package/dist/worker/index.d.ts.map +1 -0
- package/dist/worker/index.js +1 -2
- package/package.json +84 -8
- package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"camera-actor.d.ts","sourceRoot":"","sources":["../../../../src/gameplay/actors/builtin/camera-actor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,SAAS,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAIhE,qBACa,WAAY,SAAQ,SAAS;IACtC,MAAM,EAAE,eAAe,CAA0B;CACpD"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import{__decorate as o}from"tslib";import{Actor as r,BaseActor as t}from"../actor.js";import{CameraComponent as m}from"../camera/camera-component.js";import{attach as e}from"../component.js";let s=class extends t{constructor(){super(...arguments),this.camera=e(m)}};s=o([r()],s);export{s as CameraActor}
|
2
|
-
/*
|
1
|
+
import{__decorate as o}from"tslib";import{Actor as r,BaseActor as t}from"../actor.js";import{CameraComponent as m}from"../camera/camera-component.js";import{attach as e}from"../component.js";let s=class extends t{constructor(){super(...arguments),this.camera=e(m)}};s=o([r()],s);export{s as CameraActor};/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"character-animation.d.ts","sourceRoot":"","sources":["../../../../../../src/gameplay/actors/builtin/components/character/character-animation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAa,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AACxE,OAAO,EAAE,SAAS,EAAkB,MAAM,sCAAsC,CAAA;AAGhF,OAAO,EAAkB,eAAe,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,EAAY,MAAM,OAAO,CAAA;AAIhG,qBACa,2BAA4B,SAAQ,cAAc;IAC7D,OAAO,CAAC,cAAc,CAAyB;IAC/C,OAAO,CAAC,KAAK,CAAgB;IAC7B,OAAO,CAAC,aAAa,CAA8B;IACnD,OAAO,CAAC,kBAAkB,CAA8B;IACxD,OAAO,CAAC,QAAQ,CAAK;IAErB,OAAO,CAAC,gBAAgB,CAAC,CAAQ;IACjC,OAAO,CAAC,qBAAqB,CAAC,CAAQ;IAK/B,aAAa,MAAO;IAK3B,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,eAAe,CAAiB;IACxC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,YAAY,CAAQ;IAC5B,OAAO,CAAC,aAAa,CAAQ;IAE7B,OAAO,CAAC,cAAc,CAAI;IAC1B,OAAO,CAAC,iBAAiB,CAAQ;IAEjC,OAAO,CAAC,aAAa,CAAI;IACzB,OAAO,CAAC,uBAAuB,CAAK;IACpC,OAAO,CAAC,wBAAwB,CAAK;IAErC,OAAO,CAAC,iBAAiB,CAAC,CAA4B;IAEtD,MAAM,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ9B,mBAAmB,IAAI,eAAe;IActC;;;OAGG;IACH,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,aAAa,CAAC,EAAE,IAAI,EAAE,EAAE,QAAQ,CAAC,EAAE,IAAI;IAa7D;;OAEG;IAEH,OAAO,CAAC,mBAAmB;IAsB3B,OAAO,CAAC,cAAc;IAoCtB,OAAO,CAAC,iBAAiB;IAezB,gBAAgB,CAAC,EAAE,EAAE,qBAAqB;IAI1C,qBAAqB,CAAC,EAAE,EAAE,qBAAqB;IAI/C,kBAAkB,CAAC,EAAE,EAAE,qBAAqB;IAM5C,uBAAuB,CAAC,EAAE,EAAE,qBAAqB;IAKjD,SAAS,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,GAAE,WAAgB;IAexD,OAAO,CAAC,eAAe,CAErB;IAEF,OAAO,CAAC,gBAAgB,CAEtB;IAWF,IAAI,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,GAAE,WAAgB;IAsFnD,OAAO,CAAC,YAAY;IAYpB;;;;;;OAMG;IACH,UAAU,CAAC,aAAa,EAAE,eAAe,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,GAAE,WAAgB;CA4B1F;AAsED,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC;IAChC,OAAO,EAAE,OAAO,CAAA;IAChB,uDAAuD;IACvD,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,SAAS,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAC,CAAA"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import{__decorate as t}from"tslib";import{ActorComponent as e,Component as i}from"../../../component.js";import{RootMotionClip as o}from"../../../../animation/root-motion.js";import{inject as r}from"../../../../inject.js";import{ViewController as s}from"../../../../services/render.js";import{AnimationMixer as n,Bone as p,Object3D as l,LoopOnce as h}from"three";import{CharacterMovementComponent as u}from"./character-movement.js";let a=class extends e{constructor(){super(...arguments),this.viewController=r(s),this.stateMachines=[],this.upperStateMachines=[],this.fadeTime=.2,this.movementSpeed=null,this.upperBodyTimer=0,this.upperBodyOverride=!1,this.fullBodyTimer=0,this.currentFullBodyPriority=-1,this.currentUpperBodyPriority=-1,this.getFullBodyClip=y((t=>t.uuid),(t=>c(this.fullBodyMask,t))),this.getUpperBodyClip=y((t=>t.uuid),(t=>c(this.upperBodyMask,t)))}onInit(){this.viewController.onUpdate(this.actor).subscribe((t=>this.updateInternal(t))),this.characterMovement=this.actor.getComponent(u)}getRootMotionAction(){if(this.fullBodyAction.getClip()instanceof o)return this.fullBodyAction}setup(t,e,i){null!=e&&(this.upperBodyMask=d(e),this.fullBodyMask=function(t,e){const i=new Set(d(e).map((t=>t.uuid))),o=[];return t.traverse((t=>{(t instanceof p||t.isBone)&&!i.has(t.uuid)&&o.push(t)})),o}(function(t){let e;return t.traverse((t=>{(t instanceof p||t.isBone)&&null==e&&(e=t)})),e}(t),e)),null!=this.mixer&&this.mixer.stopAllAction(),this.mixer=new n(t)}updateStateMachines(t){this.stateMachines.forEach((e=>{e.step(t);const i=e.current.clip;null!=i&&this.play(i,{priority:0,loop:e.current.options.loop??!0})})),this.upperStateMachines.forEach((e=>{e.step(t);const i=e.current.clip;null!=i?this.playUpper(i,{priority:0,loop:e.current.options.loop??!0}):this.play(this.fullBodyClip)}))}updateInternal(t){null!=this.mixer&&(this.upperBodyTimer+=t,this.fullBodyTimer+=t,this.upperBodyAction&&this.upperBodyOverride&&this.upperBodyAction.getClip().duration-2*(this.overrideFadeTimeUpper??this.fadeTime)<this.upperBodyTimer&&(this.upperBodyOverride=!1,null!=this.fullBodyClip&&this.transition(this.upperBodyAction,this.getUpperBodyClip(this.fullBodyClip)),this.upperBodyAction=null,this.overrideFadeTimeUpper=null),this.fullBodyAction&&this.fullBodyAction.loop===h&&this.fullBodyAction.getClip().duration-2*(this.overrideFadeTime??this.fadeTime)<this.fullBodyTimer&&(this.currentFullBodyPriority=-1,this.overrideFadeTime=null),null!=this.characterMovement&&(this.movementSpeed=this.characterMovement.horizontalSpeed),this.updateStateMachines(t),this.syncMovementSpeed(this.fullBodyAction),this.upperBodyOverride||this.syncMovementSpeed(this.upperBodyAction),this.mixer.update(t))}syncMovementSpeed(t){if(null!=t){const e=t.getClip();if(e instanceof o&&e.fixedInPlace&&null!=this.movementSpeed){t.timeScale=e.duration/e.displacement*this.movementSpeed;const i=this.mixer.getRoot();i instanceof l&&(t.timeScale/=i.scale.x)}}}playStateMachine(t){this.stateMachines.push(t)}playUpperStateMachine(t){this.upperStateMachines.push(t)}removeStateMachine(t){const e=this.stateMachines.indexOf(t);e>=0&&this.stateMachines.splice(e,1)}removeUpperStateMachine(t){const e=this.upperStateMachines.indexOf(t);e>=0&&this.upperStateMachines.splice(e,1)}playUpper(t,e={}){const i=e?.priority??1;i<this.currentUpperBodyPriority||(this.currentUpperBodyPriority=i,this.upperBodyAction=this.transition(this.upperBodyAction,this.getUpperBodyClip(t),e),this.upperBodyTimer=0,this.upperBodyOverride=!0,this.overrideFadeTimeUpper=e.fadeTime)}play(t,e={}){!function(t,e){if(!1===t||"function"==typeof t&&!1===t())throw new Error(e)}(null!=this.mixer,"Can't play animation before setup is called");const i=e.priority??1;i<this.currentFullBodyPriority||(this.currentFullBodyPriority=i,this.fullBodyTimer=0,this.upperBodyOverride||(this.upperBodyAction=this.transition(this.upperBodyAction,this.getUpperBodyClip(t),e)),this.fullBodyClip=t,this.fullBodyAction=this.transition(this.fullBodyAction,this.getFullBodyClip(t),e),this.fullBodyAction.getClip().uuid==this.upperBodyAction.getClip().uuid&&this.upperBodyAction.syncWith(this.fullBodyAction),this.overrideFadeTime=e.fadeTime)}onActionDone(t){return new Promise((e=>{const i=o=>{o.action===t&&(e(o.action),this.mixer.removeEventListener("finished",i))};this.mixer.addEventListener("finished",i)}))}transition(t,e,i={}){if(null!=t&&t.getClip().uuid===e.uuid)return t;if(t){const o=t,r=t=this.mixer.clipAction(e);r.play(),r.enabled=!0,r.setEffectiveTimeScale(1),r.setEffectiveWeight(1),r.time=0,o.crossFadeTo(r,i?.fadeTime??this.fadeTime,!0)}else t=this.mixer.clipAction(e),t?.fadeIn(.3),t?.play();return!1===i.loop&&(t.setLoop(h,1),t.clampWhenFinished=!0,t.reset()),t}};a=t([i({inEditor:!0})],a);export{a as CharacterAnimationComponent};function c(t,e){if(null==t)return e;const i=e.clone(),o=new Set(t.map((t=>t.name)));return i.tracks=i.tracks.filter((t=>o.has(t.name.split(".")[0]))),i}function d(t){return t.flatMap((t=>function(t){const e=[];return t.traverse((t=>{e.push(t)})),e}(t))).filter((t=>t instanceof p))}function y(t,e){const i=new Map;return(o,...r)=>{const s=t(o);return i.has(s)||i.set(s,e(o,...r)),i.get(s)}}
|
2
|
-
/*
|
1
|
+
import{__decorate as t}from"tslib";import{ActorComponent as e,Component as i}from"../../../component.js";import{RootMotionClip as o}from"../../../../animation/root-motion.js";import{inject as r}from"../../../../inject.js";import{ViewController as s}from"../../../../services/render.js";import{AnimationMixer as n,Bone as p,Object3D as l,LoopOnce as h}from"three";import{CharacterMovementComponent as u}from"./character-movement.js";let a=class extends e{constructor(){super(...arguments),this.viewController=r(s),this.stateMachines=[],this.upperStateMachines=[],this.fadeTime=.2,this.movementSpeed=null,this.upperBodyTimer=0,this.upperBodyOverride=!1,this.fullBodyTimer=0,this.currentFullBodyPriority=-1,this.currentUpperBodyPriority=-1,this.getFullBodyClip=y((t=>t.uuid),(t=>c(this.fullBodyMask,t))),this.getUpperBodyClip=y((t=>t.uuid),(t=>c(this.upperBodyMask,t)))}onInit(){this.viewController.onUpdate(this.actor).subscribe((t=>this.updateInternal(t))),this.characterMovement=this.actor.getComponent(u)}getRootMotionAction(){if(this.fullBodyAction.getClip()instanceof o)return this.fullBodyAction}setup(t,e,i){null!=e&&(this.upperBodyMask=d(e),this.fullBodyMask=function(t,e){const i=new Set(d(e).map((t=>t.uuid))),o=[];return t.traverse((t=>{(t instanceof p||t.isBone)&&!i.has(t.uuid)&&o.push(t)})),o}(function(t){let e;return t.traverse((t=>{(t instanceof p||t.isBone)&&null==e&&(e=t)})),e}(t),e)),null!=this.mixer&&this.mixer.stopAllAction(),this.mixer=new n(t)}updateStateMachines(t){this.stateMachines.forEach((e=>{e.step(t);const i=e.current.clip;null!=i&&this.play(i,{priority:0,loop:e.current.options.loop??!0})})),this.upperStateMachines.forEach((e=>{e.step(t);const i=e.current.clip;null!=i?this.playUpper(i,{priority:0,loop:e.current.options.loop??!0}):this.play(this.fullBodyClip)}))}updateInternal(t){null!=this.mixer&&(this.upperBodyTimer+=t,this.fullBodyTimer+=t,this.upperBodyAction&&this.upperBodyOverride&&this.upperBodyAction.getClip().duration-2*(this.overrideFadeTimeUpper??this.fadeTime)<this.upperBodyTimer&&(this.upperBodyOverride=!1,null!=this.fullBodyClip&&this.transition(this.upperBodyAction,this.getUpperBodyClip(this.fullBodyClip)),this.upperBodyAction=null,this.overrideFadeTimeUpper=null),this.fullBodyAction&&this.fullBodyAction.loop===h&&this.fullBodyAction.getClip().duration-2*(this.overrideFadeTime??this.fadeTime)<this.fullBodyTimer&&(this.currentFullBodyPriority=-1,this.overrideFadeTime=null),null!=this.characterMovement&&(this.movementSpeed=this.characterMovement.horizontalSpeed),this.updateStateMachines(t),this.syncMovementSpeed(this.fullBodyAction),this.upperBodyOverride||this.syncMovementSpeed(this.upperBodyAction),this.mixer.update(t))}syncMovementSpeed(t){if(null!=t){const e=t.getClip();if(e instanceof o&&e.fixedInPlace&&null!=this.movementSpeed){t.timeScale=e.duration/e.displacement*this.movementSpeed;const i=this.mixer.getRoot();i instanceof l&&(t.timeScale/=i.scale.x)}}}playStateMachine(t){this.stateMachines.push(t)}playUpperStateMachine(t){this.upperStateMachines.push(t)}removeStateMachine(t){const e=this.stateMachines.indexOf(t);e>=0&&this.stateMachines.splice(e,1)}removeUpperStateMachine(t){const e=this.upperStateMachines.indexOf(t);e>=0&&this.upperStateMachines.splice(e,1)}playUpper(t,e={}){const i=e?.priority??1;i<this.currentUpperBodyPriority||(this.currentUpperBodyPriority=i,this.upperBodyAction=this.transition(this.upperBodyAction,this.getUpperBodyClip(t),e),this.upperBodyTimer=0,this.upperBodyOverride=!0,this.overrideFadeTimeUpper=e.fadeTime)}play(t,e={}){!function(t,e){if(!1===t||"function"==typeof t&&!1===t())throw new Error(e)}(null!=this.mixer,"Can't play animation before setup is called");const i=e.priority??1;i<this.currentFullBodyPriority||(this.currentFullBodyPriority=i,this.fullBodyTimer=0,this.upperBodyOverride||(this.upperBodyAction=this.transition(this.upperBodyAction,this.getUpperBodyClip(t),e)),this.fullBodyClip=t,this.fullBodyAction=this.transition(this.fullBodyAction,this.getFullBodyClip(t),e),this.fullBodyAction.getClip().uuid==this.upperBodyAction.getClip().uuid&&this.upperBodyAction.syncWith(this.fullBodyAction),this.overrideFadeTime=e.fadeTime)}onActionDone(t){return new Promise((e=>{const i=o=>{o.action===t&&(e(o.action),this.mixer.removeEventListener("finished",i))};this.mixer.addEventListener("finished",i)}))}transition(t,e,i={}){if(null!=t&&t.getClip().uuid===e.uuid)return t;if(t){const o=t,r=t=this.mixer.clipAction(e);r.play(),r.enabled=!0,r.setEffectiveTimeScale(1),r.setEffectiveWeight(1),r.time=0,o.crossFadeTo(r,i?.fadeTime??this.fadeTime,!0)}else t=this.mixer.clipAction(e),t?.fadeIn(.3),t?.play();return!1===i.loop&&(t.setLoop(h,1),t.clampWhenFinished=!0,t.reset()),t}};a=t([i({inEditor:!0})],a);export{a as CharacterAnimationComponent};function c(t,e){if(null==t)return e;const i=e.clone(),o=new Set(t.map((t=>t.name)));return i.tracks=i.tracks.filter((t=>o.has(t.name.split(".")[0]))),i}function d(t){return t.flatMap((t=>function(t){const e=[];return t.traverse((t=>{e.push(t)})),e}(t))).filter((t=>t instanceof p))}function y(t,e){const i=new Map;return(o,...r)=>{const s=t(o);return i.has(s)||i.set(s,e(o,...r)),i.get(s)}}/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"character-movement copy.d.ts","sourceRoot":"","sources":["../../../../../../src/gameplay/actors/builtin/components/character/character-movement copy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAC/F,OAAO,EAAE,aAAa,EAAiB,MAAM,4DAA4D,CAAC;AAE1G,OAAO,EAAS,OAAO,EAAa,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,cAAc,EAAa,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAMnD,qBACa,0BAA2B,SAAQ,cAAc;IA+B9C,OAAO,CAAC,aAAa;IA5BjC,QAAQ,CAAC,cAAc,YAAkB;IACzC,QAAQ,CAAC,SAAS,cAAoB;IACtC,QAAQ,CAAC,WAAW,cAAoB;IACxC,QAAQ,CAAC,aAAa,gBAAsB;IAGrC,eAAe,SAAI;IAGnB,QAAQ,SAAI;IACZ,iBAAiB,SAAI;IACrB,cAAc,SAAK;IACnB,oBAAoB,SAAK;IACzB,YAAY,SAAI;IAChB,sBAAsB,SAAK;IAC3B,oBAAoB,UAAQ;IAC5B,eAAe,EAAE,MAAM,CAAO;IAC9B,cAAc,EAAE,MAAM,CAAM;IAC5B,cAAc,EAAE,MAAM,CAAK;IAGlC,QAAQ,CAAC,QAAQ,UAAgB;IACjC,IAAI,wBAAgC;IACpC,WAAW,UAAQ;IACnB,WAAW,UAAQ;IAEnB,OAAO,CAAC,aAAa,CAAsB;gBAEvB,aAAa,EAAE,aAAa;IAEhD,MAAM,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IA4K9B,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,MAAM;IAKP,mBAAmB;IAI1B,IAAW,UAAU,YAEpB;IAED,OAAO,CAAC,oBAAoB;IAM5B,OAAO,CAAC,IAAI;IA4BZ,OAAO,CAAC,eAAe;CAW1B"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import{__decorate as t,__metadata as i}from"tslib";import{ActionInput as s,AxisInput as e,RotationInput as o}from"../../../../../gameplay/input/index.js";import{PhysicsSystem as n,RayTestResult as r}from"../../../../../gameplay/services/physics/physics-system.js";import{toDegrees as a}from"../../../../../utils/math.js";import{Vector3 as h,MathUtils as l}from"three";import{ActorComponent as c,Component as p}from"../../../component.js";import{CharacterMovementMode as y}from"./modes.js";import{CapsuleCollisionShape as m}from"../../../../../scene/collision/collision-shape.js";import{takeUntil as d}from"rxjs";import{PhysicsBodyType as u}from"../../../../services/physics/physics-system.js";let g=class extends c{constructor(t){super(),this.physicsSystem=t,this.directionInput=new e,this.jumpInput=new s,this.sprintInput=new s,this.rotationInput=new o,this.horizontalSpeed=0,this.maxSpeed=8,this.maxSpeedBackwards=8,this.maxSpeedSprint=10,this.maxWalkingSlopeAngle=70,this.jumpVelocity=7,this.fallingMovementControl=.5,this.fallingReorientation=!1,this.gravityOverride=null,this.colliderHeight=2.5,this.colliderRadius=.5,this.velocity=new h,this.mode=y.walking,this.isSprinting=!1,this.pressedJump=!1,this.rayTestResult=new r}onInit(){this.physicsSystem.addActor(this.actor,[this.createCollisionShape()],{mass:0,type:u.kinematic}),this.rotationInput.rotation.copy(this.actor.rotation);let t=this.rotationInput.rotation.y;const i=new h,s=new h,e=new h,o=new h,n=new h;let c=0;this.physicsSystem.afterStep.pipe(d(this.disposed)).subscribe((r=>{this.pressedJump=this.jumpInput.activated,this.isSprinting=this.sprintInput.activated;let a=t-this.rotationInput.rotation.y;t=this.rotationInput.rotation.y,e.copy(this.actor.position),o.set(-this.directionInput.vector.x,0,this.directionInput.vector.y).normalize();const p=o.z<0?this.maxSpeedBackwards:this.isSprinting?this.maxSpeedSprint:this.maxSpeed,m=o.clone().applyAxisAngle(new h(0,1,0),this.rotationInput.rotation.y);this.mode===y.walking&&(0!==m.length()?(c=Math.min(p,c),c=l.lerp(c,p,4*r)):c=0,n.copy(m).multiplyScalar(c),this.pressedJump&&(this.mode=y.falling,this.velocity.copy(n),this.velocity.y=this.jumpVelocity)),this.mode===y.falling&&(this.velocity.y+=r*this.getEffectiveGravity(),n.copy(this.velocity),n.add(m.clone().multiplyScalar(p*this.fallingMovementControl*r)),this.fallingReorientation&&n.applyAxisAngle(new h(0,1,0),-a)),s.copy(n).normalize(),i.copy(n),this.actor.rotation.y-=a;const d=this.actor.position.add(n.multiplyScalar(r));this.moveTo(d),f(),this.isGrounded?this.velocity.y<=0&&(this.mode=y.walking,this.velocity.y=0):(this.mode=y.falling,this.velocity.copy(i)),this.mode===y.walking&&v(r),x(r),this.horizontalSpeed=c}));const p=new h(0,1,0),m=new h(0,-.1,0),g=new h,S=new h,f=()=>{const t=this.colliderHeight+2*this.colliderRadius;this.physicsSystem.rayTest(g.addVectors(this.actor.position,p.set(0,t/4,0)),S.addVectors(this.actor.position,m),this.rayTestResult,{excludeActor:this.actor})},v=t=>{if(this.isGrounded){const s=Math.acos(this.rayTestResult.hitNormal.y),o=this.rayTestResult.hitPoint.y;if(a(s)<this.maxWalkingSlopeAngle){this.actor.position.y=o;const s=this.actor.position.sub(e).normalize().multiplyScalar(i.length()*t);this.moveTo(e.clone().add(s))}}},w=new r,x=t=>{const i=this.physicsSystem.getActorContacts(this.actor,s).filter((t=>a(Math.acos(-t.ni.y))>this.maxWalkingSlopeAngle));if(i.length>0){if(i[0].ni.clone().dot(s)<=0)return;this.moveTo(e);const o=i[0].rj.clone(),n=this.getWallDirection(i[0].ni,s);if(!this.physicsSystem.rayTest(o,n.clone().multiplyScalar(this.colliderRadius).add(o),w,{debugColor:0}).hasHit){const i=s.dot(n),e=n.multiplyScalar(this.horizontalSpeed*i);e.y+=this.velocity.y,e.multiplyScalar(t);const o=this.actor.position.clone().add(e);this.moveTo(o)}}}}getWallDirection(t,i){const s=t.clone().negate().cross(new h(0,1,0));return s.dot(i)<0?s.negate():s}moveTo(t){this.actor.position.copy(t),this.physicsSystem.updateActorTransform(this.actor)}getEffectiveGravity(){return this.gravityOverride??this.physicsSystem.getGravity().y}get isGrounded(){return this.rayTestResult.hasHit}createCollisionShape(){const t=new m(this.colliderHeight,this.colliderRadius);return t.offset.y=this.colliderRadius+this.colliderHeight/2,t}step(t){}performMovement(t){}};g=t([p(),i("design:paramtypes",[n])],g);export{g as CharacterMovementComponent}
|
2
|
-
/*
|
1
|
+
import{__decorate as t,__metadata as i}from"tslib";import{ActionInput as s,AxisInput as e,RotationInput as o}from"../../../../../gameplay/input/index.js";import{PhysicsSystem as n,RayTestResult as r}from"../../../../../gameplay/services/physics/physics-system.js";import{toDegrees as a}from"../../../../../utils/math.js";import{Vector3 as h,MathUtils as l}from"three";import{ActorComponent as c,Component as p}from"../../../component.js";import{CharacterMovementMode as y}from"./modes.js";import{CapsuleCollisionShape as m}from"../../../../../scene/collision/collision-shape.js";import{takeUntil as d}from"rxjs";import{PhysicsBodyType as u}from"../../../../services/physics/physics-system.js";let g=class extends c{constructor(t){super(),this.physicsSystem=t,this.directionInput=new e,this.jumpInput=new s,this.sprintInput=new s,this.rotationInput=new o,this.horizontalSpeed=0,this.maxSpeed=8,this.maxSpeedBackwards=8,this.maxSpeedSprint=10,this.maxWalkingSlopeAngle=70,this.jumpVelocity=7,this.fallingMovementControl=.5,this.fallingReorientation=!1,this.gravityOverride=null,this.colliderHeight=2.5,this.colliderRadius=.5,this.velocity=new h,this.mode=y.walking,this.isSprinting=!1,this.pressedJump=!1,this.rayTestResult=new r}onInit(){this.physicsSystem.addActor(this.actor,[this.createCollisionShape()],{mass:0,type:u.kinematic}),this.rotationInput.rotation.copy(this.actor.rotation);let t=this.rotationInput.rotation.y;const i=new h,s=new h,e=new h,o=new h,n=new h;let c=0;this.physicsSystem.afterStep.pipe(d(this.disposed)).subscribe((r=>{this.pressedJump=this.jumpInput.activated,this.isSprinting=this.sprintInput.activated;let a=t-this.rotationInput.rotation.y;t=this.rotationInput.rotation.y,e.copy(this.actor.position),o.set(-this.directionInput.vector.x,0,this.directionInput.vector.y).normalize();const p=o.z<0?this.maxSpeedBackwards:this.isSprinting?this.maxSpeedSprint:this.maxSpeed,m=o.clone().applyAxisAngle(new h(0,1,0),this.rotationInput.rotation.y);this.mode===y.walking&&(0!==m.length()?(c=Math.min(p,c),c=l.lerp(c,p,4*r)):c=0,n.copy(m).multiplyScalar(c),this.pressedJump&&(this.mode=y.falling,this.velocity.copy(n),this.velocity.y=this.jumpVelocity)),this.mode===y.falling&&(this.velocity.y+=r*this.getEffectiveGravity(),n.copy(this.velocity),n.add(m.clone().multiplyScalar(p*this.fallingMovementControl*r)),this.fallingReorientation&&n.applyAxisAngle(new h(0,1,0),-a)),s.copy(n).normalize(),i.copy(n),this.actor.rotation.y-=a;const d=this.actor.position.add(n.multiplyScalar(r));this.moveTo(d),f(),this.isGrounded?this.velocity.y<=0&&(this.mode=y.walking,this.velocity.y=0):(this.mode=y.falling,this.velocity.copy(i)),this.mode===y.walking&&v(r),x(r),this.horizontalSpeed=c}));const p=new h(0,1,0),m=new h(0,-.1,0),g=new h,S=new h,f=()=>{const t=this.colliderHeight+2*this.colliderRadius;this.physicsSystem.rayTest(g.addVectors(this.actor.position,p.set(0,t/4,0)),S.addVectors(this.actor.position,m),this.rayTestResult,{excludeActor:this.actor})},v=t=>{if(this.isGrounded){const s=Math.acos(this.rayTestResult.hitNormal.y),o=this.rayTestResult.hitPoint.y;if(a(s)<this.maxWalkingSlopeAngle){this.actor.position.y=o;const s=this.actor.position.sub(e).normalize().multiplyScalar(i.length()*t);this.moveTo(e.clone().add(s))}}},w=new r,x=t=>{const i=this.physicsSystem.getActorContacts(this.actor,s).filter((t=>a(Math.acos(-t.ni.y))>this.maxWalkingSlopeAngle));if(i.length>0){if(i[0].ni.clone().dot(s)<=0)return;this.moveTo(e);const o=i[0].rj.clone(),n=this.getWallDirection(i[0].ni,s);if(!this.physicsSystem.rayTest(o,n.clone().multiplyScalar(this.colliderRadius).add(o),w,{debugColor:0}).hasHit){const i=s.dot(n),e=n.multiplyScalar(this.horizontalSpeed*i);e.y+=this.velocity.y,e.multiplyScalar(t);const o=this.actor.position.clone().add(e);this.moveTo(o)}}}}getWallDirection(t,i){const s=t.clone().negate().cross(new h(0,1,0));return s.dot(i)<0?s.negate():s}moveTo(t){this.actor.position.copy(t),this.physicsSystem.updateActorTransform(this.actor)}getEffectiveGravity(){return this.gravityOverride??this.physicsSystem.getGravity().y}get isGrounded(){return this.rayTestResult.hasHit}createCollisionShape(){const t=new m(this.colliderHeight,this.colliderRadius);return t.offset.y=this.colliderRadius+this.colliderHeight/2,t}step(t){}performMovement(t){}};g=t([p(),i("design:paramtypes",[n])],g);export{g as CharacterMovementComponent};/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"character-movement.d.ts","sourceRoot":"","sources":["../../../../../../src/gameplay/actors/builtin/components/character/character-movement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAC/F,OAAO,EAAE,aAAa,EAAiB,MAAM,4DAA4D,CAAC;AAC1G,OAAO,EAAoB,OAAO,EAAwB,eAAe,EAAE,MAAM,OAAO,CAAC;AACzF,OAAO,EAAE,cAAc,EAAa,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAkBnD,qBACa,0BAA2B,SAAQ,cAAc;IA0D9C,OAAO,CAAC,aAAa;IAvDjC,QAAQ,CAAC,cAAc,YAAkB;IACzC,QAAQ,CAAC,SAAS,cAAoB;IACtC,QAAQ,CAAC,WAAW,cAAoB;IACxC,QAAQ,CAAC,aAAa,gBAAsB;IAGrC,eAAe,SAAI;IAGnB,QAAQ,SAAI;IACZ,iBAAiB,SAAI;IACrB,cAAc,SAAK;IACnB,YAAY,SAAI;IAChB,sBAAsB,SAAK;IAC3B,oBAAoB,UAAQ;IAC5B,eAAe,EAAE,MAAM,CAAO;IAC9B,cAAc,EAAE,MAAM,CAAI;IAC1B,cAAc,EAAE,MAAM,CAAK;IAC3B,SAAS,UAAQ;IACjB,IAAI,SAAK;IACT,YAAY,UAAO;IACnB,kBAAkB,SAAyB;IAC3C,kBAAkB,SAAyB;IAC3C,4BAA4B,UAAO;IAC1C,oCAAoC;IAC7B,kBAAkB,UAAQ;IACjC,IAAW,gBAAgB,IACW,MAAM,CADuB;IACnE,IAAW,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAA4G;IACxJ,IAAW,sBAAsB,IAAI,OAAO,CAAmD;IAC/F,IAAW,sBAAsB,CAAC,OAAO,EAAE,OAAO,EAA8F;IAChJ,IAAW,iBAAiB,IACY,MAAM,CADuB;IACrE,IAAW,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAA4G;IAC1J,IAAW,YAAY,IACW,MAAM,CAD2B;IACnE,IAAW,YAAY,CAAC,QAAQ,EAAE,MAAM,EAA0C;IAClF,IAAW,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAiC;IACnE,IAAW,MAAM,IADW,MAAM,CACa;IAC/C,IAAW,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAA0C;IACrF,IAAW,iBAAiB,IADS,MAAM,CAC0B;IAErE;;;;OAIG;IACI,OAAO,UAAO;IAGrB,QAAQ,CAAC,QAAQ,UAAgB;IACjC,IAAI,wBAAgC;IACpC,WAAW,UAAQ;IACnB,WAAW,UAAQ;IAEnB,OAAO,CAAC,EAAE,CAAqC;IAC/C,OAAO,CAAC,aAAa,CAAsB;gBAEvB,aAAa,EAAE,aAAa;IAOhD,OAAO,CAAC,eAAe,CAAQ;IAC/B,OAAO,CAAC,qBAAqB,CAAwB;IAErD;;;OAGG;IACI,yBAAyB,UAAQ;IAExC,mEAAmE;IAC5D,cAAc,UAAO;IAE5B,MAAM,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAiT9B,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,gBAAgB,CAAiB;IAClC,mBAAmB,CAAC,MAAM,EAAE,eAAe;IAUlD,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,MAAM;IAKP,mBAAmB;IAI1B,OAAO,CAAC,aAAa;IAkBrB,IAAW,UAAU,YAEpB;IAED,OAAO,CAAC,oBAAoB;IAO5B,OAAO,CAAC,IAAI;IA8BZ,OAAO,CAAC,eAAe;IAWvB,OAAO,CAAC,WAAW;CAQtB"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import{__decorate as t,__metadata as
|
2
|
-
/*
|
1
|
+
import{__decorate as t,__metadata as e}from"tslib";import{ActionInput as i,AxisInput as o,RotationInput as s}from"../../../../../gameplay/input/index.js";import{PhysicsSystem as n,RayTestResult as r}from"../../../../../gameplay/services/physics/physics-system.js";import{MathUtils as a,Vector3 as c,ArrowHelper as l}from"three";import{ActorComponent as h,Component as p}from"../../../component.js";import{CharacterMovementMode as m}from"./modes.js";import{CapsuleCollisionShape as d}from"../../../../../scene/collision/collision-shape.js";import{takeUntil as u}from"rxjs";import{PhysicsBodyType as y}from"../../../../services/physics/physics-system.js";import g from"@dimforge/rapier3d-compat";import{RootMotionClip as f}from"../../../../../gameplay/animation/root-motion.js";import*as S from"three";import{clamp as w}from"../../../../../utils/math.js";const v=new c,M=new c,A=1/30,x=-131071;let T=class extends h{get autoStepMinWidth(){return this.cc.autostepMinWidth()}set autoStepMinWidth(t){this.cc.enableAutostep(this.cc.autostepMaxHeight(),t,this.cc.autostepIncludesDynamicBodies())}get autoStepDynamicObjects(){return this.cc.autostepIncludesDynamicBodies()}set autoStepDynamicObjects(t){this.cc.enableAutostep(this.cc.autostepMaxHeight(),this.cc.autostepMinWidth(),t)}get autoStepMaxHeight(){return this.cc.autostepMaxHeight()}set autoStepMaxHeight(t){this.cc.enableAutostep(t,this.cc.autostepMinWidth(),this.cc.autostepIncludesDynamicBodies())}get snapToGround(){return this.cc.snapToGroundDistance()}set snapToGround(t){this.cc.enableSnapToGround(t)}set offset(t){this.cc.setOffset(t)}get offset(){return this.cc.offset()}set normalNudgeFactor(t){this.cc.setNormalNudgeFactor(t)}get normalNudgeFactor(){return this.cc.normalNudgeFactor()}constructor(t){super(),this.physicsSystem=t,this.directionInput=new o,this.jumpInput=new i,this.sprintInput=new i,this.rotationInput=new s,this.horizontalSpeed=0,this.maxSpeed=8,this.maxSpeedBackwards=8,this.maxSpeedSprint=12,this.jumpVelocity=7,this.fallingMovementControl=.5,this.fallingReorientation=!1,this.gravityOverride=null,this.colliderHeight=2,this.colliderRadius=.5,this.jumpInAir=!1,this.mass=50,this.allowSliding=!0,this.minSlopeSlideAngle=a.degToRad(70),this.maxSlopeClimbAngle=a.degToRad(70),this.applyImpulsesToDynamicBodies=!0,this.characterCollision=!1,this.enabled=!0,this.velocity=new c,this.mode=m.walking,this.isSprinting=!1,this.pressedJump=!1,this.rayTestResult=new r,this.resetRootMotion=!1,this.rotateToMovementDirection=!1,this.smoothRotation=!0;const e=this.cc=this.physicsSystem.getCharacterController(.1);e.enableSnapToGround(.1),e.enableAutostep(0,.1,!1)}onInit(){const t=this.cc;t.setApplyImpulsesToDynamicBodies(this.applyImpulsesToDynamicBodies),t.setMinSlopeSlideAngle(this.minSlopeSlideAngle),t.setMaxSlopeClimbAngle(this.maxSlopeClimbAngle),t.setCharacterMass(this.mass),t.setSlideEnabled(this.allowSliding),this.physicsSystem.addActor(this.actor,[this.createCollisionShape()],{mass:0,type:y.kinematic,continousCollisionDetection:!1,friction:0,restitution:.5,ignoreForNavMesh:!0}),this.rotationInput.rotation.copy(this.actor.rotation);let e=this.rotationInput.rotation.y;const i=new c,o=new c,s=new c,n=new c(0,0,1),r=new c,l=new c,h=new c;let p=0,d=null;const g=new c,T=new c,C=new c,j=new c,R=new c,G=this.characterCollision?null:x;this.physicsSystem.beforeStep.pipe(u(this.disposed)).subscribe((u=>{if(this.checkGrounded(u),!this.enabled)return;if(null!=this.rootMotionAction){if(this.rootMotionAction.getClip()instanceof f){const t=this.rootMotionInterpolant;this.resetRootMotion&&(g.fromArray(t.evaluate(0)),this.resetRootMotion=!1),j.fromArray(t.evaluate(this.rootMotionAction.time)),T.subVectors(j,g),g.copy(j),this.rootMotionAction.getRoot().getWorldScale(C),T.multiply(C)}}u>A&&(u=A);const y=null!=this.rootMotionAction&&this.rootMotionAction.enabled&&0!=T.length();this.pressedJump=this.jumpInput.activated,this.isSprinting=this.sprintInput.activated;let x=this.rotationInput.rotation.y-e;s.copy(this.actor.position),r.set(-this.directionInput.vector.x,0,this.directionInput.vector.y).normalize();const V=!this.rotateToMovementDirection&&r.z<0?this.maxSpeedBackwards:this.isSprinting?this.maxSpeedSprint:this.maxSpeed;if(h.set(0,0,0),this.rotateToMovementDirection){if(r.lengthSq()>0){z.setFromUnitVectors(n.clone().normalize(),r.clone().normalize()),n.copy(r);const t=(x%(2*Math.PI)+3*Math.PI)%(2*Math.PI)-Math.PI,i=Math.abs(t),o=this.smoothRotation?w(10*u*t,-i,i):t;H.setFromEuler(k.set(0,o,0)),z.multiply(H),this.actor.object.applyQuaternion(z),h.copy(this.actor.object.getWorldDirection(F).normalize()),e+=o}}else h.copy(r).applyAxisAngle(I,this.rotationInput.rotation.y),e=this.rotationInput.rotation.y,this.actor.rotation.y+=x;if(R.set(0,0,0),this.rayTestResult.hasHit&&null!=this.rayTestResult.actor&&this.physicsSystem.getLinearVelocity(this.rayTestResult.actor,R),this.mode===m.walking?(0!==h.length()?(p=Math.min(V,p),p=a.lerp(p,V,4*u)):p=0,l.copy(h).multiplyScalar(p),this.pressedJump&&(this.mode=m.falling,this.velocity.copy(l),this.velocity.y=this.jumpVelocity),l.y=.016*this.getEffectiveGravity(),l.add(R)):this.mode===m.falling&&(this.pressedJump&&this.jumpInAir&&(this.mode=m.falling,this.velocity.copy(l),this.velocity.y=this.jumpVelocity),this.velocity.y+=u*this.getEffectiveGravity(),l.copy(this.velocity),l.addScaledVector(h,this.fallingMovementControl),this.fallingReorientation&&l.applyAxisAngle(new c(0,1,0),x)),o.copy(l).normalize(),i.copy(l),l.length(),y?(T.applyAxisAngle(I,this.actor.rotation.y),T.y+=u*this.getEffectiveGravity(),v.copy(T)):v.copy(l).multiplyScalar(u),this.isGrounded&&this.mode===m.walking&&(this.rayTestResult.distance>t.offset()||(v.y=Math.max(0,R.y*u)),this.physicsSystem.getActorComputedMovement(this.actor,t,v,G),t.computedCollision(0,D),null!=D&&null!=D.normal1)){const e=(new S.Vector3).copy(D.normal1);Math.acos(e.dot(I))>t.maxSlopeClimbAngle()&&(v.y=.016*this.getEffectiveGravity()*.5)}M.copy(this.physicsSystem.getActorComputedMovement(this.actor,t,v,G)),this.physicsSystem.setNextKinematicTranslation(this.actor,M);let E=function(t){if(t.numComputedCollisions()>0){const e=t.computedCollision(0);b.x=e.normal2.x,b.y=e.normal2.y,b.z=e.normal2.z;const i=b.angleTo(I);b.x=e.normal1.x,b.y=e.normal1.y,b.z=e.normal1.z;const o=b.angleTo(I);return!(i<100)&&o>t.minSlopeSlideAngle()}return!1}(t);y||this.isGrounded&&!E||this.mode!==m.falling&&(null==d?d=performance.now():performance.now()-d>100&&(this.mode=m.falling,this.velocity.copy(i))),this.isGrounded&&this.velocity.y<=0&&(this.mode,m.falling,this.mode=m.walking,this.velocity.y=0,d=null),this.mode,m.walking,this.horizontalSpeed=p}))}debugDirection(){const t=new l(v,this.actor.position,1,65280);this.actor.object.parent.add(t),setTimeout((()=>{t.removeFromParent()}),30);const e=new l(M,this.actor.position,1,16711680);this.actor.object.parent.add(e),setTimeout((()=>{e.removeFromParent()}),30)}setRootMotionAction(t){const e=t?.getClip();if(e instanceof f){this.rootMotionAction=t,this.resetRootMotion=!0;const i=[];this.rootMotionInterpolant=e.motionTrack.InterpolantFactoryMethodSmooth(i)}}getWallDirection(t,e){const i=t.clone().negate().cross(I);return i.dot(e)<0?i.negate():i}moveTo(t){this.actor.position.copy(t),this.physicsSystem.updateActorTransform(this.actor)}getEffectiveGravity(){return this.gravityOverride??this.physicsSystem.getGravity().y}checkGrounded(t){this.colliderHeight,this.colliderRadius;G.y=-.05,this.physicsSystem.rayTest(C.addVectors(this.actor.position,R.set(0,this.offset,0)),j.addVectors(this.actor.position,G),this.rayTestResult,{excludeActor:this.actor,excludeTriggers:!0})}get isGrounded(){return this.rayTestResult.hasHit||this.cc.computedGrounded()}createCollisionShape(){const t=new d(this.colliderHeight,this.colliderRadius);return t.offset.y=this.colliderRadius+this.colliderHeight/2+this.offset,t.collisionGroup=x,t}step(t){}performMovement(t){}arrowHelper(t,e,i){const o=new l(t,e,1,i);this.actor.object.parent.add(o),setTimeout((()=>{o.removeFromParent()}),30)}};T=t([p({inEditor:!1}),e("design:paramtypes",[n])],T);export{T as CharacterMovementComponent};const I=new c(0,1,0),b=new c;const C=new c,j=new c,R=new c(0,1,0),G=new c(0,-.1,0),D=(new c(0,-1,0),new g.CharacterCollision),z=new S.Quaternion,H=new S.Quaternion,k=new S.Euler,F=new S.Vector3;/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"modes.d.ts","sourceRoot":"","sources":["../../../../../../src/gameplay/actors/builtin/components/character/modes.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;GAWG;AAEH,oBAAY,qBAAqB;IAC7B,OAAO,IAAA;IACP,QAAQ,IAAA;IACR,OAAO,IAAA;IACP,MAAM,IAAA;CACT"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
export var CharacterMovementMode;!function(e){e[e.walking=0]="walking",e[e.swimming=1]="swimming",e[e.falling=2]="falling",e[e.flying=3]="flying"}(CharacterMovementMode||(CharacterMovementMode={}))
|
2
|
-
/*
|
1
|
+
export var CharacterMovementMode;!function(e){e[e.walking=0]="walking",e[e.swimming=1]="swimming",e[e.falling=2]="falling",e[e.flying=3]="flying"}(CharacterMovementMode||(CharacterMovementMode={}));/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mesh-component.d.ts","sourceRoot":"","sources":["../../../../../src/gameplay/actors/builtin/components/mesh-component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,aAAa,EACd,MAAM,yDAAyD,CAAA;AAIhE,OAAO,EAAE,KAAK,EAAQ,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACtD,OAAO,EAAE,cAAc,EAAa,MAAM,oBAAoB,CAAA;AAU9D,qBACa,aAAa,CAAC,IAAI,SAAS,QAAQ,GAAG,QAAQ,CAAE,SAAQ,cAAc;IAmCrE,OAAO,CAAC,aAAa;IA/BjC,MAAM,EAAE,IAAI,CAAA;IAGZ,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAgB;IAG1C,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAc;IAGtC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAqB;IAG5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAA6B;IAGlD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAiC;IAO1D,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAyB;IAG3D,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAQ;IAEnC,QAAQ,CAAC,2BAA2B,EAAE,OAAO,CAAoD;IAEjG,OAAO,CAAC,WAAW,CAAM;gBAEL,aAAa,EAAE,aAAa;IAIhD,MAAM,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAUvB,SAAS,CAAC,WAAW,EAAE,IAAI;IAQlC,OAAO,CAAC,UAAU;IAkBlB,OAAO,CAAC,kBAAkB;CAc3B"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import{__decorate as t,__metadata as s}from"tslib";import{PhysicsBodyType as i,PhysicsSystem as e}from"../../../../gameplay/services/physics/physics-system.js";import{AssetMeshInstance as o}from"../../../../scene/asset-resource-loader.js";import{PhysicalShapeMesh as r}from"../../../../index.js";import{Parameter as n}from"../../../../shader/parameter.js";import{Euler as c,Object3D as h,Vector3 as p}from"three";import{ActorComponent as a,Component as l}from"../../component.js";import{firstValueFrom as
|
2
|
-
/*
|
1
|
+
import{__decorate as t,__metadata as s}from"tslib";import{PhysicsBodyType as i,PhysicsSystem as e}from"../../../../gameplay/services/physics/physics-system.js";import{AssetMeshInstance as o}from"../../../../scene/asset-resource-loader.js";import{PhysicalShapeMesh as r}from"../../../../index.js";import{Parameter as n}from"../../../../shader/parameter.js";import{Euler as c,Object3D as h,Vector3 as p}from"three";import{ActorComponent as a,Component as l}from"../../component.js";import{firstValueFrom as m}from"rxjs";const y={friction:.1,mass:0,bodyType:i.static,continousCollisionDetection:!1};let d=class extends a{constructor(t){super(),this.physicsSystem=t,this.position=new p,this.rotation=new c,this.scale=new p(1,1,1),this.mass=y.mass,this.friction=y.friction,this.bodyType=i.static,this.isTrigger=!1,this.continousCollisionDetection=y.continousCollisionDetection}onInit(){null!=this.object&&(this.currentMesh=this.object,this.updateMesh()),m(this.disposed).then((()=>{this.physicsSystem.removeActor(this.actor)}))}setObject(t){null!=this.currentMesh&&this.actor.object.remove(this.currentMesh),this.object=this.currentMesh=t,this.updateMesh()}updateMesh(){this.currentMesh.position.copy(this.position),this.currentMesh.rotation.copy(this.rotation),this.currentMesh.scale.copy(this.scale);const t=this.getCollisionShapes();t.length>0&&this.physicsSystem.addActor(this.actor,t,{...y,isTrigger:this.isTrigger??!1,mass:this.mass,friction:this.friction,type:this.bodyType,continousCollisionDetection:this.continousCollisionDetection}),this.actor.object.add(this.currentMesh)}getCollisionShapes(){return this.currentMesh instanceof o?this.currentMesh.collisionShapes:this.currentMesh instanceof r?[this.currentMesh.collisionShape]:"collisionShape"in this.currentMesh?(console.error("Could not understand wehre to get collision shapes from. This is likely due to an import issue"),[this.currentMesh.collisionShape]):[]}};t([n({type:h}),s("design:type",Object)],d.prototype,"object",void 0),t([n(),s("design:type",p)],d.prototype,"position",void 0),t([n(),s("design:type",c)],d.prototype,"rotation",void 0),t([n(),s("design:type",p)],d.prototype,"scale",void 0),t([n(),s("design:type",Number)],d.prototype,"mass",void 0),t([n(),s("design:type",Number)],d.prototype,"friction",void 0),t([n({options:[{name:"Static",value:i.static},{name:"Kinematic",value:i.kinematic},{name:"Dynamic",value:i.dynamic}]}),s("design:type",Number)],d.prototype,"bodyType",void 0),t([n(),s("design:type",Boolean)],d.prototype,"isTrigger",void 0),d=t([l({inEditor:!0}),s("design:paramtypes",[e])],d);export{d as MeshComponent};/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"scene-component.d.ts","sourceRoot":"","sources":["../../../../../src/gameplay/actors/builtin/components/scene-component.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAa,MAAM,oBAAoB,CAAC;AAG/D,qBACa,cAAe,SAAQ,cAAc;IAChD,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,OAAO,CAAgB;IAC/B,IAAW,MAAM,CAAC,MAAM,EAAE,cAAc,EAGvC;IACD,IAAW,MAAM,IAJS,cAAc,CAIG;CAC5C"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import{__decorate as t}from"tslib";import{Group as r}from"three";import{ActorComponent as e,Component as n}from"../../component.js";let o=class extends e{constructor(){super(...arguments),this.container=new r}set parent(t){this._parent=t,t.container.add(this.container)}get parent(){return this._parent}};o=t([n()],o);export{o as SceneComponent}
|
2
|
-
/*
|
1
|
+
import{__decorate as t}from"tslib";import{Group as r}from"three";import{ActorComponent as e,Component as n}from"../../component.js";let o=class extends e{constructor(){super(...arguments),this.container=new r}set parent(t){this._parent=t,t.container.add(this.container)}get parent(){return this._parent}};o=t([n()],o);export{o as SceneComponent};/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/gameplay/actors/builtin/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,YAAY,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;;;;;;;;AAEpD,wBAMC"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import{CameraActor as o}from"./camera-actor.js";import r from"./navmesh-actor.js";import{PositionalAudioActor as a}from"./positional-audio-actor.js";import{SpawnPoint as i}from"./spawn-point.js";import{TriggerVolume as m}from"./trigger-volume.js";export default{Camera:o,SpawnPoint:i,TriggerVolume:m,PositionalAudio:a,NavMesh:r}
|
2
|
-
/*
|
1
|
+
import{CameraActor as o}from"./camera-actor.js";import r from"./navmesh-actor.js";import{PositionalAudioActor as a}from"./positional-audio-actor.js";import{SpawnPoint as i}from"./spawn-point.js";import{TriggerVolume as m}from"./trigger-volume.js";export default{Camera:o,SpawnPoint:i,TriggerVolume:m,PositionalAudio:a,NavMesh:r};/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"navmesh-actor.d.ts","sourceRoot":"","sources":["../../../../src/gameplay/actors/builtin/navmesh-actor.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAK5C,OAAO,EAAS,SAAS,EAA2D,MAAM,QAAQ,CAAC;AAcnG,wBAAsB,cAAc,4BASnC;AASD,MAAM,MAAM,aAAa,GAAG;IAO1B,IAAI,QAAE;CACP,CAAA;AAGD,cACM,YAAa,SAAQ,SAAS;IAClC,OAAO,CAAC,OAAO,CAAwB;IACvC,OAAO,CAAC,IAAI,CAAyB;IACrC,OAAO,CAAC,KAAK,CAAgB;IAEhB,KAAK,EAAE,OAAO,CAAO;IAElC,SAAS,EAAE,MAAM,CAAO;IAIxB,OAAO,CAAC,QAAQ,CAAc;IAIjB,aAAa,EAAE,MAAM,CAAK;IACV,kBAAkB,EAAE,MAAM,CAAK;IAI/C,QAAQ,EAAE,MAAM,CAAM;IAG5B,OAAO,EAAE,OAAO,CAAA;IAEjB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAY7B,OAAO,CAAC,IAAI;CA4Ob;AAED,eAAe,YAAY,CAAA"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import{__decorate as e,__metadata as t}from"tslib";import{Ball as o,Capsule as n,Cone as s,ConvexPolyhedron as i,Cuboid as r,Cylinder as a,Heightfield as c,ShapeType as l,TriMesh as h}from"@dimforge/rapier3d-compat";import{init as p}from"@recast-navigation/core";import{DebugDrawer as u,getPositionsAndIndices as d}from"@recast-navigation/three";import{BehaviorSubject as f,debounceTime as m,filter as w,firstValueFrom as g,takeUntil as b}from"rxjs";import*as y from"three";import{BufferGeometryUtils as x,ConvexHull as v}from"three/examples/jsm/Addons.js";import{Actor as B,BaseActor as M,Parameter as S,PhysicsSystem as z,ViewController as j,World as k,inject as A}from"../../";import{DynamicTiledNavMesh as C}from"../../ai/dynamic-tiled-navmesh";import{hasSharedArrayBufferSupport as F,toSharedFloat32Array as G,toSharedUint32Array as P}from"../../../utils/buffer";import{sleepDelay as N}from"../../../utils/async";var V;!function(e){e[e.none=0]="none",e[e.starting=1]="starting",e[e.started=2]="started"}(V||(V={}));let D=V.none,I=new f(!1);export async function safeRecastInit(){return D===V.none?(D=V.starting,p().then((()=>{I.next(!0),D=V.started}))):g(I.pipe(w((e=>e))))}const E=new y.Box3(new y.Vector3(-100,-100,-100),new y.Vector3(100,100,100)),H=navigator.hardwareConcurrency??1;let R=!1,T=class extends M{constructor(){super(...arguments),this.physics=A(z),this.view=A(j),this.world=A(k),this.debug=!0,this.refreshMs=4e3,this.tileSize=400,this.walkableClimb=.3,this.walkableSlopeAngle=45,this.cellSize=.2}async onInit(){R||(await safeRecastInit(),R=!0),setTimeout((()=>{this.init()}),1e3)}init(){const e=this.cellSize,t={tileSize:400,walkableClimb:this.walkableClimb/e,walkableSlopeAngle:this.walkableSlopeAngle,walkableRadius:2,walkableHeight:5,detailSampleDist:1,minRegionArea:6,mergeRegionArea:400,cs:e,ch:e,maxSimplificationError:1.3,maxEdgeLen:200},o=new y.Box3;for(const e of this.physics.staticBodies.keys())e.traverse((t=>{t.isMesh&&t.geometry&&(t.geometry.computeBoundingBox(),o.expandByObject(e))}));o.union(E);const n=new C({navMeshBounds:o,recastConfig:t,maxTiles:1024,workers:H,cacheId:"nav"+this.object.userData?.src?.id});this.navMesh=n.navMesh,this.object.position.set(0,0,0);const s=this.tileSize*t.cs*2,i=performance.now(),r=new Map,a=new u;a.userData.isDebugDrawer=!0;n.navMesh;const c=()=>{const e=this.view.getCamera().getWorldPosition(new y.Vector3),t=new y.Box3((new y.Vector3).copy(e).subScalar(s),(new y.Vector3).copy(e).addScalar(s)),o=[],n=this.physics.world.bodies;if(null==n)return[];const i=new y.Box3;for(const e of n.getAll())for(let n=0,s=e.numColliders();n<s;n++){const s=e.collider(n);if(s.isSensor()||null!=s.parent().userData&&!0===s.parent().userData.ignoreForNavMesh)continue;const a=e.handle+","+n,c=r.get(a)?.mesh,l=c??U(s);if(q(s,l),null!=l){i.copy(l.geometry.boundingBox),i.min.add(l.position),i.max.add(l.position);const e=i.intersectsBox(t)||!0;r.set(a,{pos:s.translation(),mesh:l}),e&&o.push(l)}}return o},l=new y.Box3,h=new Map,p=new Map;let f=!0,w=performance.now(),g=!1;const x=function(e,t){let o=!1;return(async()=>{for(;!o;)await e(),await N(t)})(),()=>{o=!0}}((async()=>{if(g)return;const e=new y.Box3,t=c();for(const o of t){const t=h.get(o);!0!==t?.equals(o.position)&&(null!=t&&e.expandByPoint(t),e.expandByObject(o),h.set(o,o.position.clone()))}e.min.subScalar(50),e.max.addScalar(50);const o=n.getTilesForBounds(e);if(0!=o.length){const s=[];for(const o of t)l.setFromObject(o),l.intersectsBox(e)&&s.push(o);console.log("intersecting meshes",s.length),console.time("get positions");let[i,r]=d(s);F&&(i=G(i),r=P(r)),console.timeEnd("get positions");const a=f;f=!1,await Promise.all(o.map((e=>(w=performance.now(),n.buildTile(i,r,e,a).then((()=>{const t=e[0]+","+e[1];p.set(t,(p.get(t)??0)+1),this.debug})))))).then((()=>{this.debug,g=!1}))}else g=!1}),this.refreshMs??1e4);this.disposed.subscribe((()=>x())),n.onNavMeshUpdate.pipe(b(this.disposed),m(200)).subscribe((()=>{a.clear(),a.drawNavMesh(n.navMesh)})),console.log("Create navmesh with debug",this.debug),this.debug&&(this.object.position.set(0,0,0),this.object.scale.set(1,1,1),this.object.updateMatrix(),this.object.updateMatrixWorld(),this.object.add(a)),this.disposed.subscribe((()=>{n?.destroy(),a.removeFromParent(),a.dispose()}));const v=performance.now()-i;v>1e3&&console.warn(`NavMesh update took ${v} ms. Consider changing tileSize or other parameter that may affect performance`)}};e([S(),t("design:type",Boolean)],T.prototype,"debug",void 0),e([S(),t("design:type",Number)],T.prototype,"walkableClimb",void 0),e([S({range:[0,89]}),t("design:type",Number)],T.prototype,"walkableSlopeAngle",void 0),e([S(),t("design:type",Number)],T.prototype,"cellSize",void 0),T=e([B()],T);export default T;function O(e){if(e.shape instanceof c)return function(e){const t=e.shape;if(t.type!==l.HeightField)throw new Error("The provided collider is not a height field.");let o=!1;const n=t,s=n.heights,i=n.nrows,r=n.ncols,a=n.scale.x,c=n.scale.z,h=n.scale.y,p=i+1,u=new y.PlaneGeometry(c,a,r,i);u.rotateX(-Math.PI/2);const d=u.attributes.position.array;let f=0;for(let e=0;e<p;e++)for(let t=0;t<p;t++)d[f+1]=s[t*p+e]*h,f+=3,0!=d[f+1]&&(o=!0);if(!o){const e=new y.PlaneGeometry(a,c,2,2);return e.rotateX(-Math.PI/2),e}return u}(e);if(e.shape instanceof o)return new y.SphereGeometry(e.shape.radius);if(e.shape instanceof r){const t=e.shape.halfExtents;return new y.BoxGeometry(2*t.x,2*t.y,2*t.z)}if(e.shape instanceof i)return function(e){const t=[];for(let o=0;o<e.length;o+=3)t.push(new y.Vector3(e[o],e[o+1],e[o+2]));const o=(new v).setFromPoints(t),n=[];o.faces.forEach((e=>{const t=e.edge.head().point,o=e.edge.next.head().point,s=e.edge.next.next.head().point;n.push(t.x,t.y,t.z),n.push(o.x,o.y,o.z),n.push(s.x,s.y,s.z)}));const s=new y.BufferGeometry;return s.setAttribute("position",new y.Float32BufferAttribute(n,3)),s}(e.shape.vertices);if(e.shape instanceof h){const t=e.shape.vertices,o=e.shape.indices;let n=new y.BufferGeometry;return n.setAttribute("position",new y.Float32BufferAttribute(t,3)),null!=o?n.setIndex(new y.Uint16BufferAttribute(o,1)):n=x.mergeVertices(n),n.computeVertexNormals(),n}if(e.shape instanceof a){const t=e.shape.halfHeight,o=e.shape.radius;return new y.CylinderGeometry(o,o,2*t)}if(e.shape instanceof s){const t=e.shape.halfHeight,o=e.shape.radius;return new y.ConeGeometry(o,2*t)}if(e.shape instanceof n){const t=e.shape.halfHeight,o=e.shape.radius;return new y.CapsuleGeometry(o,2*t)}return console.warn("Unsupported shape",e.shape.type,e),null}function U(e){const t=O(e);if(null==t)return null;const o=W,n=new y.Mesh(t,o);return n.geometry.computeBoundingBox(),n.geometry.scale(1.01,1.01,1.01),n}function q(e,t){const o=e.translation(),n=e.rotation();t.position.set(o.x,o.y,o.z),t.quaternion.set(n.x,n.y,n.z,n.w)}const W=new y.MeshBasicMaterial({wireframe:!1,color:16711680,side:y.FrontSide})
|
2
|
-
/*
|
1
|
+
import{__decorate as e,__metadata as t}from"tslib";import{Ball as o,Capsule as n,Cone as s,ConvexPolyhedron as i,Cuboid as r,Cylinder as a,Heightfield as c,ShapeType as l,TriMesh as h}from"@dimforge/rapier3d-compat";import{init as p}from"@recast-navigation/core";import{DebugDrawer as u,getPositionsAndIndices as d}from"@recast-navigation/three";import{BehaviorSubject as f,debounceTime as m,filter as w,firstValueFrom as g,takeUntil as b}from"rxjs";import*as y from"three";import{BufferGeometryUtils as x,ConvexHull as v}from"three/examples/jsm/Addons.js";import{Actor as B,BaseActor as M,Parameter as S,PhysicsSystem as z,ViewController as j,World as k,inject as A}from"../../";import{DynamicTiledNavMesh as C}from"../../ai/dynamic-tiled-navmesh";import{hasSharedArrayBufferSupport as F,toSharedFloat32Array as G,toSharedUint32Array as P}from"../../../utils/buffer";import{sleepDelay as N}from"../../../utils/async";var V;!function(e){e[e.none=0]="none",e[e.starting=1]="starting",e[e.started=2]="started"}(V||(V={}));let D=V.none,I=new f(!1);export async function safeRecastInit(){return D===V.none?(D=V.starting,p().then((()=>{I.next(!0),D=V.started}))):g(I.pipe(w((e=>e))))}const E=new y.Box3(new y.Vector3(-100,-100,-100),new y.Vector3(100,100,100)),H=navigator.hardwareConcurrency??1;let R=!1,T=class extends M{constructor(){super(...arguments),this.physics=A(z),this.view=A(j),this.world=A(k),this.debug=!0,this.refreshMs=4e3,this.tileSize=400,this.walkableClimb=.3,this.walkableSlopeAngle=45,this.cellSize=.2}async onInit(){R||(await safeRecastInit(),R=!0),setTimeout((()=>{this.init()}),1e3)}init(){const e=this.cellSize,t={tileSize:400,walkableClimb:this.walkableClimb/e,walkableSlopeAngle:this.walkableSlopeAngle,walkableRadius:2,walkableHeight:5,detailSampleDist:1,minRegionArea:6,mergeRegionArea:400,cs:e,ch:e,maxSimplificationError:1.3,maxEdgeLen:200},o=new y.Box3;for(const e of this.physics.staticBodies.keys())e.traverse((t=>{t.isMesh&&t.geometry&&(t.geometry.computeBoundingBox(),o.expandByObject(e))}));o.union(E);const n=new C({navMeshBounds:o,recastConfig:t,maxTiles:1024,workers:H,cacheId:"nav"+this.object.userData?.src?.id});this.navMesh=n.navMesh,this.object.position.set(0,0,0);const s=this.tileSize*t.cs*2,i=performance.now(),r=new Map,a=new u;a.userData.isDebugDrawer=!0;n.navMesh;const c=()=>{const e=this.view.getCamera().getWorldPosition(new y.Vector3),t=new y.Box3((new y.Vector3).copy(e).subScalar(s),(new y.Vector3).copy(e).addScalar(s)),o=[],n=this.physics.world.bodies;if(null==n)return[];const i=new y.Box3;for(const e of n.getAll())for(let n=0,s=e.numColliders();n<s;n++){const s=e.collider(n);if(s.isSensor()||null!=s.parent().userData&&!0===s.parent().userData.ignoreForNavMesh)continue;const a=e.handle+","+n,c=r.get(a)?.mesh,l=c??U(s);if(q(s,l),null!=l){i.copy(l.geometry.boundingBox),i.min.add(l.position),i.max.add(l.position);const e=i.intersectsBox(t)||!0;r.set(a,{pos:s.translation(),mesh:l}),e&&o.push(l)}}return o},l=new y.Box3,h=new Map,p=new Map;let f=!0,w=performance.now(),g=!1;const x=function(e,t){let o=!1;return(async()=>{for(;!o;)await e(),await N(t)})(),()=>{o=!0}}((async()=>{if(g)return;const e=new y.Box3,t=c();for(const o of t){const t=h.get(o);!0!==t?.equals(o.position)&&(null!=t&&e.expandByPoint(t),e.expandByObject(o),h.set(o,o.position.clone()))}e.min.subScalar(50),e.max.addScalar(50);const o=n.getTilesForBounds(e);if(0!=o.length){const s=[];for(const o of t)l.setFromObject(o),l.intersectsBox(e)&&s.push(o);console.log("intersecting meshes",s.length),console.time("get positions");let[i,r]=d(s);F&&(i=G(i),r=P(r)),console.timeEnd("get positions");const a=f;f=!1,await Promise.all(o.map((e=>(w=performance.now(),n.buildTile(i,r,e,a).then((()=>{const t=e[0]+","+e[1];p.set(t,(p.get(t)??0)+1),this.debug})))))).then((()=>{this.debug,g=!1}))}else g=!1}),this.refreshMs??1e4);this.disposed.subscribe((()=>x())),n.onNavMeshUpdate.pipe(b(this.disposed),m(200)).subscribe((()=>{a.clear(),a.drawNavMesh(n.navMesh)})),console.log("Create navmesh with debug",this.debug),this.debug&&(this.object.position.set(0,0,0),this.object.scale.set(1,1,1),this.object.updateMatrix(),this.object.updateMatrixWorld(),this.object.add(a)),this.disposed.subscribe((()=>{n?.destroy(),a.removeFromParent(),a.dispose()}));const v=performance.now()-i;v>1e3&&console.warn(`NavMesh update took ${v} ms. Consider changing tileSize or other parameter that may affect performance`)}};e([S(),t("design:type",Boolean)],T.prototype,"debug",void 0),e([S(),t("design:type",Number)],T.prototype,"walkableClimb",void 0),e([S({range:[0,89]}),t("design:type",Number)],T.prototype,"walkableSlopeAngle",void 0),e([S(),t("design:type",Number)],T.prototype,"cellSize",void 0),T=e([B()],T);export default T;function O(e){if(e.shape instanceof c)return function(e){const t=e.shape;if(t.type!==l.HeightField)throw new Error("The provided collider is not a height field.");let o=!1;const n=t,s=n.heights,i=n.nrows,r=n.ncols,a=n.scale.x,c=n.scale.z,h=n.scale.y,p=i+1,u=new y.PlaneGeometry(c,a,r,i);u.rotateX(-Math.PI/2);const d=u.attributes.position.array;let f=0;for(let e=0;e<p;e++)for(let t=0;t<p;t++)d[f+1]=s[t*p+e]*h,f+=3,0!=d[f+1]&&(o=!0);if(!o){const e=new y.PlaneGeometry(a,c,2,2);return e.rotateX(-Math.PI/2),e}return u}(e);if(e.shape instanceof o)return new y.SphereGeometry(e.shape.radius);if(e.shape instanceof r){const t=e.shape.halfExtents;return new y.BoxGeometry(2*t.x,2*t.y,2*t.z)}if(e.shape instanceof i)return function(e){const t=[];for(let o=0;o<e.length;o+=3)t.push(new y.Vector3(e[o],e[o+1],e[o+2]));const o=(new v).setFromPoints(t),n=[];o.faces.forEach((e=>{const t=e.edge.head().point,o=e.edge.next.head().point,s=e.edge.next.next.head().point;n.push(t.x,t.y,t.z),n.push(o.x,o.y,o.z),n.push(s.x,s.y,s.z)}));const s=new y.BufferGeometry;return s.setAttribute("position",new y.Float32BufferAttribute(n,3)),s}(e.shape.vertices);if(e.shape instanceof h){const t=e.shape.vertices,o=e.shape.indices;let n=new y.BufferGeometry;return n.setAttribute("position",new y.Float32BufferAttribute(t,3)),null!=o?n.setIndex(new y.Uint16BufferAttribute(o,1)):n=x.mergeVertices(n),n.computeVertexNormals(),n}if(e.shape instanceof a){const t=e.shape.halfHeight,o=e.shape.radius;return new y.CylinderGeometry(o,o,2*t)}if(e.shape instanceof s){const t=e.shape.halfHeight,o=e.shape.radius;return new y.ConeGeometry(o,2*t)}if(e.shape instanceof n){const t=e.shape.halfHeight,o=e.shape.radius;return new y.CapsuleGeometry(o,2*t)}return console.warn("Unsupported shape",e.shape.type,e),null}function U(e){const t=O(e);if(null==t)return null;const o=W,n=new y.Mesh(t,o);return n.geometry.computeBoundingBox(),n.geometry.scale(1.01,1.01,1.01),n}function q(e,t){const o=e.translation(),n=e.rotation();t.position.set(o.x,o.y,o.z),t.quaternion.set(n.x,n.y,n.z,n.w)}const W=new y.MeshBasicMaterial({wireframe:!1,color:16711680,side:y.FrontSide});/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"positional-audio-actor.d.ts","sourceRoot":"","sources":["../../../../src/gameplay/actors/builtin/positional-audio-actor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAS,SAAS,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,cAAc,EAA6B,MAAM,iBAAiB,CAAC;AAO5E,qBACa,oBAAqB,SAAQ,SAAS;IACjD,KAAK,EAAE,wBAAwB,CAAmC;CACnE;AA2BD,qBACa,wBAAyB,SAAQ,cAAc;IAC7C,OAAO,CAAC,WAAW,CAAa;IAKlB,OAAO,CAAC,MAAM,CAAY;IACxC,OAAO,CAAC,IAAI,CAAiB;IAC7B,OAAO,CAAC,QAAQ,CAAgB;IACf,OAAO,CAAC,WAAW,CAAQ;IAC5C,OAAO,CAAC,YAAY,CAAQ;IAC5B,OAAO,CAAC,WAAW,CAAQ;IAKxC,OAAO,CAAC,IAAI,CAAyB;IAErC,SAAgB,KAAK,wBAAsD;IAE3E,OAAO,CAAC,aAAa,CAAmE;IAExF,MAAM,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IA6C9B,SAAS,IAAI,IAAI;CAQlB"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import{__decorate as o,__metadata as t}from"tslib";import*as s from"three";import{Actor as i,BaseActor as e}from"../actor.js";import{ActorComponent as n,Component as r,attach as a}from"../component.js";import{Parameter as d}from"../../../shader/index.js";import{ViewController as u}from"../../services/render.js";import{inject as l}from"../../inject.js";import{PositionalAudioHelper as p}from"../../../utils/three/positional-audio-helper.js";let h=class extends e{constructor(){super(...arguments),this.audio=a(c)}};h=o([i()],h);export{h as PositionalAudioActor};let m=class extends n{onInit(){const o=(new s.TextureLoader).load("assets/audio.png"),t=new s.SpriteMaterial({map:o}),i=new s.Sprite(t);this.actor.object.add(i),this.helper=new p(this.positionalAudio)}};m=o([r({inEditor:!0,editorOnly:!0})],m);let c=class extends n{constructor(){super(...arguments),this.volume=1,this.loop=!1,this.autoPlay=!0,this.view=l(u),this.sound=new s.PositionalAudio(this.view.audioListener),this.visualisation=a(m,{positionalAudio:this.sound})}onInit(){this.sound.setBuffer(this.audioBuffer),null!=this.refDistance&&this.sound.setRefDistance(Math.max(this.refDistance,0)),null!=this.rollofFactor&&this.sound.setRolloffFactor(this.rollofFactor),null!=this.maxDistance&&this.sound.setMaxDistance(this.maxDistance),null!=this.volume?this.sound.setVolume(Math.max(this.volume,0)):this.sound.setVolume(0),this.sound.loop=this.loop??!1,this.visualisation?.helper?.update(),this.actor.object.add(this.sound),this.autoPlay&&this.sound?.play(),this.disposed.subscribe((()=>{this.sound.isPlaying&&(this.sound?.stop(),console.log(this.sound.getVolume(),this.volume)),this.sound.removeFromParent()})),console.log(this.sound)}onEndPlay(){this.sound.isPlaying&&(this.sound?.stop(),this.sound.loop=!1),this.sound.removeFromParent()}};o([d(),t("design:type",AudioBuffer)],c.prototype,"audioBuffer",void 0),o([d({range:[0,1]}),t("design:type",Number)],c.prototype,"volume",void 0),o([d(),t("design:type",Boolean)],c.prototype,"loop",void 0),o([d(),t("design:type",Boolean)],c.prototype,"autoPlay",void 0),o([d({range:[0,1e3]}),t("design:type",Number)],c.prototype,"refDistance",void 0),o([d(),t("design:type",Number)],c.prototype,"rollofFactor",void 0),o([d(),t("design:type",Number)],c.prototype,"maxDistance",void 0),c=o([r({inEditor:!0})],c);export{c as PositionalAudioComponent}
|
2
|
-
/*
|
1
|
+
import{__decorate as o,__metadata as t}from"tslib";import*as s from"three";import{Actor as i,BaseActor as e}from"../actor.js";import{ActorComponent as n,Component as r,attach as a}from"../component.js";import{Parameter as d}from"../../../shader/index.js";import{ViewController as u}from"../../services/render.js";import{inject as l}from"../../inject.js";import{PositionalAudioHelper as p}from"../../../utils/three/positional-audio-helper.js";let h=class extends e{constructor(){super(...arguments),this.audio=a(c)}};h=o([i()],h);export{h as PositionalAudioActor};let m=class extends n{onInit(){const o=(new s.TextureLoader).load("assets/audio.png"),t=new s.SpriteMaterial({map:o}),i=new s.Sprite(t);this.actor.object.add(i),this.helper=new p(this.positionalAudio)}};m=o([r({inEditor:!0,editorOnly:!0})],m);let c=class extends n{constructor(){super(...arguments),this.volume=1,this.loop=!1,this.autoPlay=!0,this.view=l(u),this.sound=new s.PositionalAudio(this.view.audioListener),this.visualisation=a(m,{positionalAudio:this.sound})}onInit(){this.sound.setBuffer(this.audioBuffer),null!=this.refDistance&&this.sound.setRefDistance(Math.max(this.refDistance,0)),null!=this.rollofFactor&&this.sound.setRolloffFactor(this.rollofFactor),null!=this.maxDistance&&this.sound.setMaxDistance(this.maxDistance),null!=this.volume?this.sound.setVolume(Math.max(this.volume,0)):this.sound.setVolume(0),this.sound.loop=this.loop??!1,this.visualisation?.helper?.update(),this.actor.object.add(this.sound),this.autoPlay&&this.sound?.play(),this.disposed.subscribe((()=>{this.sound.isPlaying&&(this.sound?.stop(),console.log(this.sound.getVolume(),this.volume)),this.sound.removeFromParent()})),console.log(this.sound)}onEndPlay(){this.sound.isPlaying&&(this.sound?.stop(),this.sound.loop=!1),this.sound.removeFromParent()}};o([d(),t("design:type",AudioBuffer)],c.prototype,"audioBuffer",void 0),o([d({range:[0,1]}),t("design:type",Number)],c.prototype,"volume",void 0),o([d(),t("design:type",Boolean)],c.prototype,"loop",void 0),o([d(),t("design:type",Boolean)],c.prototype,"autoPlay",void 0),o([d({range:[0,1e3]}),t("design:type",Number)],c.prototype,"refDistance",void 0),o([d(),t("design:type",Number)],c.prototype,"rollofFactor",void 0),o([d(),t("design:type",Number)],c.prototype,"maxDistance",void 0),c=o([r({inEditor:!0})],c);export{c as PositionalAudioComponent};/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"spawn-point.d.ts","sourceRoot":"","sources":["../../../../src/gameplay/actors/builtin/spawn-point.ts"],"names":[],"mappings":"AAWA,OAAO,EAAS,SAAS,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,EAAa,cAAc,EAAkB,MAAM,iBAAiB,CAAA;AAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAA;AAI3D,qBACa,cAAe,SAAQ,cAAc;IAChD,MAAM,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAgB/B;AAED,qBACa,UAAW,SAAQ,SAAS;IACvC,OAAO,CAAC,IAAI,CAAyC;IAErD,SAAS,CAAC,QAAQ,CAAC,KAAK,QAAgB;IAExC,UAAU,CAAC,CAAC,SAAS,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;CAG3D"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import{__decorate as t}from"tslib";import{ArrowHelper as o,Vector3 as r,Euler as e}from"three";import{Actor as s,BaseActor as i}from"../actor.js";import{Component as n,ActorComponent as m,attach as p}from"../component.js";import{World as c}from"../../../gameplay/services/world.js";import{inject as a}from"../../../gameplay/inject.js";import{createLineSphere as l}from"../../../utils/three/line-sphere.js";let d=class extends m{onInit(){const t=l(1);this.actor.object.add(t);const e=new o(new r(0,0,1),new r,1,1268122,.3,.3);this.actor.object.add(e)}};d=t([n({inEditor:!0,editorOnly:!0})],d);export{d as SpawnPointMesh};let h=class extends i{constructor(){super(...arguments),this.mesh=p(d),this.world=a(c)}spawnActor(t){return this.world.spawnActor(t,this.position,new e(0,this.rotation.y,0,"XYZ"))}};h=t([s()],h);export{h as SpawnPoint}
|
2
|
-
/*
|
1
|
+
import{__decorate as t}from"tslib";import{ArrowHelper as o,Vector3 as r,Euler as e}from"three";import{Actor as s,BaseActor as i}from"../actor.js";import{Component as n,ActorComponent as m,attach as p}from"../component.js";import{World as c}from"../../../gameplay/services/world.js";import{inject as a}from"../../../gameplay/inject.js";import{createLineSphere as l}from"../../../utils/three/line-sphere.js";let d=class extends m{onInit(){const t=l(1);this.actor.object.add(t);const e=new o(new r(0,0,1),new r,1,1268122,.3,.3);this.actor.object.add(e)}};d=t([n({inEditor:!0,editorOnly:!0})],d);export{d as SpawnPointMesh};let h=class extends i{constructor(){super(...arguments),this.mesh=p(d),this.world=a(c)}spawnActor(t){return this.world.spawnActor(t,this.position,new e(0,this.rotation.y,0,"XYZ"))}};h=t([s()],h);export{h as SpawnPoint};/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"trigger-volume.d.ts","sourceRoot":"","sources":["../../../../src/gameplay/actors/builtin/trigger-volume.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmG,OAAO,EAA+C,KAAK,EAAE,MAAM,OAAO,CAAC;AACrL,OAAO,EAAS,SAAS,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAa,cAAc,EAAkB,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAGzE,OAAO,EAAkB,UAAU,EAAE,MAAM,MAAM,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAG9C,qBACa,iBAAkB,SAAQ,cAAc;IACtC,KAAK,EAAE,KAAK,CAAsB;IAE/C,OAAO,CAAC,UAAU,CAA8B;IAEhD,MAAM,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAY/B;AAED,qBACa,sBAAuB,SAAQ,cAAc;IAO5C,OAAO,CAAC,aAAa;IANjC,SAAgB,UAAU,EAAE,OAAO,CAAqB;IACxD,SAAgB,MAAM,EAAE,OAAO,CAAqB;IAGpD,OAAO,CAAC,UAAU,CAA+C;gBAE7C,aAAa,EAAE,aAAa;IAIzC,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAe9B,uBAAuB,CAAC,CAAC,SAAS,SAAS,EAChD,KAAK,EAAE,CAAC,GACP,UAAU,CAAC,CAAC,CAAC;IAIT,qBAAqB,CAAC,CAAC,SAAS,SAAS,EAC9C,KAAK,EAAE,CAAC,GACP,UAAU,CAAC,CAAC,CAAC;IAIT,2BAA2B,CAAC,CAAC,SAAS,SAAS,EACpD,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,GACjB,UAAU,CAAC,CAAC,CAAC;IAIT,yBAAyB,CAAC,CAAC,SAAS,SAAS,EAClD,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,GACjB,UAAU,CAAC,CAAC,CAAC;CAGjB;AAED,qBACa,aAAc,SAAQ,SAAS;IAC1C,OAAO,yBAAiC;CACzC"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import{__decorate as t,__metadata as s}from"tslib";import{EdgesGeometry as i,LineSegments as e,LineBasicMaterial as o,Vector3 as r,BoxGeometry as n,Mesh as h,MeshBasicMaterial as c,Group as p,Color as m}from"three";import{Actor as a,BaseActor as d}from"../actor.js";import{Component as l,ActorComponent as y,attach as f}from"../component.js";import{PhysicsSystem as w}from"../../services/physics/physics-system.js";import{BoxCollisionShape as v}from"../../../scene/collision/collision-shape.js";import{Parameter as O}from"../../../shader/parameter.js";import{firstValueFrom as g}from"rxjs";let u=class extends y{constructor(){super(...arguments),this.color=new m(16777215),this.dimensions=new r(1,1,1)}onInit(){const t=new n(this.dimensions.x,this.dimensions.y,this.dimensions.z),s=new i(t),r=new e(s,new o({color:this.color})),m=(new h(t,new c({color:this.color,transparent:!0,opacity:.3,visible:!1})),new p);m.add(r),this.actor.object.add(m)}};t([O(),s("design:type",m)],u.prototype,"color",void 0),u=t([l({inEditor:!0,editorOnly:!0})],u);export{u as TriggerVolumeMesh};let A=class extends y{constructor(t){super(),this.physicsSystem=t,this.dimensions=new r(1,1,1),this.offset=new r(0,0,0),this.editorMesh=f(u)}onInit(){this.physicsSystem.addActor(this.actor,[new v(this.dimensions).withOffset(this.offset)],{isTrigger:!0}),g(this.disposed).then((()=>{this.physicsSystem.removeActor(this.actor)}))}onBeginOverlapWithActor(t){return this.physicsSystem.onBeginOverlapWithActor(this.actor,t)}onEndOverlapWithActor(t){return this.physicsSystem.onEndOverlapWithActor(this.actor,t)}onBeginOverlapWithActorType(t){return this.physicsSystem.onBeginOverlapWithActorType(this.actor,t)}onEndOverlapWithActorType(t){return this.physicsSystem.onEndOverlapWithActorType(this.actor,t)}};A=t([l({inEditor:!0,editorOnly:!1}),s("design:paramtypes",[w])],A);export{A as TriggerVolumeComponent};let x=class extends d{constructor(){super(...arguments),this.trigger=f(A)}};x=t([a()],x);export{x as TriggerVolume}
|
2
|
-
/*
|
1
|
+
import{__decorate as t,__metadata as s}from"tslib";import{EdgesGeometry as i,LineSegments as e,LineBasicMaterial as o,Vector3 as r,BoxGeometry as n,Mesh as h,MeshBasicMaterial as c,Group as p,Color as m}from"three";import{Actor as a,BaseActor as d}from"../actor.js";import{Component as l,ActorComponent as y,attach as f}from"../component.js";import{PhysicsSystem as w}from"../../services/physics/physics-system.js";import{BoxCollisionShape as v}from"../../../scene/collision/collision-shape.js";import{Parameter as O}from"../../../shader/parameter.js";import{firstValueFrom as g}from"rxjs";let u=class extends y{constructor(){super(...arguments),this.color=new m(16777215),this.dimensions=new r(1,1,1)}onInit(){const t=new n(this.dimensions.x,this.dimensions.y,this.dimensions.z),s=new i(t),r=new e(s,new o({color:this.color})),m=(new h(t,new c({color:this.color,transparent:!0,opacity:.3,visible:!1})),new p);m.add(r),this.actor.object.add(m)}};t([O(),s("design:type",m)],u.prototype,"color",void 0),u=t([l({inEditor:!0,editorOnly:!0})],u);export{u as TriggerVolumeMesh};let A=class extends y{constructor(t){super(),this.physicsSystem=t,this.dimensions=new r(1,1,1),this.offset=new r(0,0,0),this.editorMesh=f(u)}onInit(){this.physicsSystem.addActor(this.actor,[new v(this.dimensions).withOffset(this.offset)],{isTrigger:!0}),g(this.disposed).then((()=>{this.physicsSystem.removeActor(this.actor)}))}onBeginOverlapWithActor(t){return this.physicsSystem.onBeginOverlapWithActor(this.actor,t)}onEndOverlapWithActor(t){return this.physicsSystem.onEndOverlapWithActor(this.actor,t)}onBeginOverlapWithActorType(t){return this.physicsSystem.onBeginOverlapWithActorType(this.actor,t)}onEndOverlapWithActorType(t){return this.physicsSystem.onEndOverlapWithActorType(this.actor,t)}};A=t([l({inEditor:!0,editorOnly:!1}),s("design:paramtypes",[w])],A);export{A as TriggerVolumeComponent};let x=class extends d{constructor(){super(...arguments),this.trigger=f(A)}};x=t([a()],x);export{x as TriggerVolume};/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"camera-component.d.ts","sourceRoot":"","sources":["../../../../src/gameplay/actors/camera/camera-component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmG,iBAAiB,EAAW,MAAM,OAAO,CAAC;AAEpJ,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAqB,MAAM,iBAAiB,CAAC;AAOpE,qBACa,eAAgB,SAAQ,cAAc;IAUrC,OAAO,CAAC,cAAc;IATd,IAAI,EAAE,MAAM,CAAc;IAC1B,GAAG,EAAE,MAAM,CAAa;IACxB,SAAS,EAAE,MAAM,CAAqB;IAE1D,OAAO,CAAC,SAAS,CAAiC;IAElD,OAAO,CAAC,MAAM,CAA6F;IACpG,QAAQ,EAAE,iBAAiB,CAA0E;gBAExF,cAAc,EAAE,cAAc;IAElD,MAAM,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAM/B;AAKD,qBACa,UAAW,SAAQ,cAAc;IAC1C,OAAO,CAAC,UAAU,CAAW;IAC7B,MAAM,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAwBjC"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import{__decorate as e,__metadata as t}from"tslib";import{ArrowHelper as r,ConeGeometry as i,EdgesGeometry as s,LineBasicMaterial as o,LineSegments as n,MeshStandardMaterial as a,PerspectiveCamera as l,Vector3 as h}from"three";import{Parameter as d}from"../../../shader/parameter.js";import{ViewController as c}from"../../services/render.js";import{ActorComponent as p,attach as w,Component as m}from"../component.js";const v=void 0!==window&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);let b=class extends p{constructor(e){super(),this.viewController=e,this.near=.5,this.far=500,this.viewAngle=v?30:45,this.debugMesh=w(y),this.aspect=this.viewController.htmlElement.clientWidth/this.viewController.htmlElement.clientHeight,this.instance=new l(this.viewAngle,this.aspect,this.near,this.far)}onInit(){this.actor.object.add(this.instance),this.instance.near=this.near,this.instance.far=this.far,this.instance.fov=this.viewAngle}};e([d(),t("design:type",Number)],b.prototype,"near",void 0),e([d(),t("design:type",Number)],b.prototype,"far",void 0),e([d(),t("design:type",Number)],b.prototype,"viewAngle",void 0),b=e([m({inEditor:!0}),t("design:paramtypes",[c])],b);export{b as CameraComponent};let y=class extends p{constructor(){super(...arguments),this.arrowColor=16101442}onInit(){const e=new i(1,1,4);e.rotateX(Math.PI/2),e.rotateZ(Math.PI/4),e.scale(1,9/16,1);const t=new s(e),l=(new a({color:3355443}),new n(t,new o({color:16777215}))),d=new r(new h(0,0,-1),new h(0,0,0),1.2,this.arrowColor,.15,.2);l.add(d),d.layers.disableAll(),d.layers.enable(19),d.traverse((e=>{e.layers.disableAll(),e.layers.enable(19)})),this.actor.object.add(l)}};y=e([m({inEditor:!0,editorOnly:!0})],y);export{y as CameraMesh}
|
2
|
-
/*
|
1
|
+
import{__decorate as e,__metadata as t}from"tslib";import{ArrowHelper as r,ConeGeometry as i,EdgesGeometry as s,LineBasicMaterial as o,LineSegments as n,MeshStandardMaterial as a,PerspectiveCamera as l,Vector3 as h}from"three";import{Parameter as d}from"../../../shader/parameter.js";import{ViewController as c}from"../../services/render.js";import{ActorComponent as p,attach as w,Component as m}from"../component.js";const v=void 0!==window&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);let b=class extends p{constructor(e){super(),this.viewController=e,this.near=.5,this.far=500,this.viewAngle=v?30:45,this.debugMesh=w(y),this.aspect=this.viewController.htmlElement.clientWidth/this.viewController.htmlElement.clientHeight,this.instance=new l(this.viewAngle,this.aspect,this.near,this.far)}onInit(){this.actor.object.add(this.instance),this.instance.near=this.near,this.instance.far=this.far,this.instance.fov=this.viewAngle}};e([d(),t("design:type",Number)],b.prototype,"near",void 0),e([d(),t("design:type",Number)],b.prototype,"far",void 0),e([d(),t("design:type",Number)],b.prototype,"viewAngle",void 0),b=e([m({inEditor:!0}),t("design:paramtypes",[c])],b);export{b as CameraComponent};let y=class extends p{constructor(){super(...arguments),this.arrowColor=16101442}onInit(){const e=new i(1,1,4);e.rotateX(Math.PI/2),e.rotateZ(Math.PI/4),e.scale(1,9/16,1);const t=new s(e),l=(new a({color:3355443}),new n(t,new o({color:16777215}))),d=new r(new h(0,0,-1),new h(0,0,0),1.2,this.arrowColor,.15,.2);l.add(d),d.layers.disableAll(),d.layers.enable(19),d.traverse((e=>{e.layers.disableAll(),e.layers.enable(19)})),this.actor.object.add(l)}};y=e([m({inEditor:!0,editorOnly:!0})],y);export{y as CameraMesh};/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
@@ -52,3 +52,4 @@ export declare class ThirdPersonCameraComponent extends ActorComponent {
|
|
52
52
|
/** @deprecated Use ThirdPersonCameraComponent. No difference just renamed */
|
53
53
|
export declare class ThirdPartyCameraComponent extends ThirdPersonCameraComponent {
|
54
54
|
}
|
55
|
+
//# sourceMappingURL=third-person-camera-component.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"third-person-camera-component.d.ts","sourceRoot":"","sources":["../../../../src/gameplay/actors/camera/third-person-camera-component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA6B,MAAM,iBAAiB,CAAC;AAE5E,OAAO,EAAqB,iBAAiB,EAAC,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAiB,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EAAE,aAAa,EAAiB,MAAM,0CAA0C,CAAC;AAUxF;;;GAGG;AACH,qBACa,0BAA2B,SAAQ,cAAc;IA+BhD,OAAO,CAAC,cAAc;IAAkB,OAAO,CAAC,aAAa;IA7BzE,OAAO,CAAC,MAAM,CAA6F;IACvF,IAAI,EAAE,MAAM,CAAc;IAC1B,GAAG,EAAE,MAAM,CAAa;IACxB,SAAS,EAAE,MAAM,CAAqB;IACnD,MAAM,EAAE,iBAAiB,CAA0E;IAEnG,QAAQ,EAAE,MAAM,CAAI;IACpB,WAAW,EAAE,MAAM,CAAM;IACzB,WAAW,SAAgB;IAC3B,MAAM,SAAI;IACV,OAAO,SAAK;IACZ,OAAO,SAAM;IACb,YAAY,EAAE,OAAO,CAAO;IAC5B,eAAe,SAAI;IAE1B,OAAO,CAAC,oBAAoB,CAAK;IACjC,OAAO,CAAC,kBAAkB,CAA4C;IAEtE,SAAgB,aAAa,0BAAwD;IACrF,SAAgB,SAAS,eAA4B;IAErD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgB;IAEvC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA2C;IAEjE,WAAW,UAAO;IAEzB,OAAO,CAAC,KAAK,CAAgB;gBAET,cAAc,EAAE,cAAc,EAAU,aAAa,EAAE,aAAa;IAEjF,aAAa,UAAQ;IACtB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAYtB,QAAQ;IAuBR,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAI5C,OAAO,KAAK,OAAO,GAElB;IAED,OAAO,CAAC,MAAM,CAAqB;IAC5B,UAAU;IAkBjB,OAAO,CAAC,wBAAwB,CAAO;IAEhC,UAAU;IAOjB,OAAO,CAAC,WAAW,CAIlB;IAED,OAAO,CAAC,SAAS,CAIhB;IAED,OAAO,CAAC,mBAAmB,CAK1B;IAED,OAAO,CAAC,eAAe;IAkBvB,OAAO,CAAC,iBAAiB;IA0CzB,OAAO,CAAC,iBAAiB;IAWzB,OAAO,CAAC,oBAAoB;CAoB7B;AAcD,8EAA8E;AAC9E,qBAAa,yBAA0B,SAAQ,0BAA0B;CAAG"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import{__decorate as t,__metadata as e}from"tslib";import{ActorComponent as i,Component as s}from"../component.js";import{Vector3 as o,MathUtils as n,PerspectiveCamera as a}from"three";import{ViewController as r}from"../../services/render.js";import{DecimalInput as h,RestrictedRotationInput as c}from"../../input/index.js";import{PhysicsSystem as d,RayTestResult as m}from"../../services/physics/physics-system.js";import{Parameter as l}from"../../../shader/parameter.js";import{World as p}from"../../services/world.js";import{inject as u}from"../../inject.js";const f=void 0!==window&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);let w=class extends i{constructor(t,e){super(),this.viewController=t,this.physicsSystem=e,this.aspect=this.viewController.htmlElement.clientWidth/this.viewController.htmlElement.clientHeight,this.near=.5,this.far=500,this.viewAngle=f?30:45,this.camera=new a(this.viewAngle,this.aspect,this.near,this.far),this.distance=9,this.minDistance=1.5,this.maxDistance=this.distance,this.height=3,this.offsetX=-1,this.offsetZ=1.5,this.autoActivate=!0,this.bounceBackSpeed=5,this.collisionCheckRadius=.5,this.restrictedDistance=Math.max(this.distance,this.maxDistance),this.rotationInput=new c(-Math.PI/4,Math.PI/2-.7),this.zoomInput=new h(1,0,1),this.offset=new o,this.lookAtOffset=new o(this.offsetX,0,this.offsetZ),this.fixedBehind=!0,this.world=u(p),this.isMouseLocked=!1,this.canvas=null,this.pointerLockInactivatedAt=null,this.onMouseDown=t=>{this.isMouseLocked||"mouse"!==t.pointerType||this.hideCursor()},this.onKeyDown=t=>{"Escape"===t.key&&this.showCursor()},this.onPointerLockChange=()=>{null!=document.pointerLockElement||null!=document.mozPointerLockElement||this.showCursor()}}async onInit(){this.world.scene.add(this.camera),this.rotationInput.rotation.copy(this.actor.rotation),this.restrictedDistance=Math.max(this.distance,this.maxDistance),this.lookAtOffset.set(this.offsetX,0,this.offsetZ),this.autoActivate&&this.activate()}activate(){this.viewController.setCamera(this.camera);const t=this.element;null!=document.body.requestPointerLock&&(t.addEventListener("pointerdown",this.onMouseDown),t.addEventListener("keydown",this.onKeyDown),document.addEventListener("pointerlockchange",this.onPointerLockChange,!1),this.disposed.subscribe((()=>{t.removeEventListener("pointerdown",this.onMouseDown),t.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("pointerlockchange",this.onPointerLockChange,!1)})))}onLateUpdate(t){this.setFromRotation(t)}get element(){return this.viewController.htmlElement}hideCursor(){null!=this.pointerLockInactivatedAt&&performance.now()-this.pointerLockInactivatedAt<1600||(this.element.style.cursor="none",null==this.canvas&&(this.canvas=this.element.getElementsByTagName("canvas")[0]),this.canvas&&(this.canvas.requestPointerLock(),this.isMouseLocked=!0))}showCursor(){this.pointerLockInactivatedAt=performance.now(),this.element.style.cursor="default",window.document.exitPointerLock(),this.isMouseLocked=!1}setFromRotation(t){this.checkForCollision(t);const e=n.clamp(Math.min(this.restrictedDistance,this.distance),Math.min(this.minDistance,this.restrictedDistance),Math.max(this.distance*this.zoomInput.value,this.minDistance)),i=Math.cos(this.rotationInput.rotation.x)*e,s=this.fixedBehind?0:this.rotationInput.rotation.y;this.offset.x=Math.sin(-s)*i,this.offset.y=Math.sin(this.rotationInput.rotation.x)*e+2,this.offset.z=Math.cos(-s)*-i,this.offset.add(this.lookAtOffset),this.updateCameraPosition()}checkForCollision(t){const e=this.getLookAtPosition(),i=y;let s=!1,o=this.distance;const a=new m,r=this.camera.getWorldPosition(g);for(let t=-1;t<=1;t++){const n=k.subVectors(r,e);i.copy(r).add(n.multiplyScalar(1.2)),i.x+=t*this.collisionCheckRadius,this.physicsSystem.rayTest(e,i,a,{debugLifetime:0,excludeActor:this.actor,excludeTriggers:!0}),a.hasHit&&a.distance<this.distance&&(o=Math.min(a.distance,o),s
|
2
|
-
/*
|
1
|
+
import{__decorate as t,__metadata as e}from"tslib";import{ActorComponent as i,Component as s}from"../component.js";import{Vector3 as o,MathUtils as n,PerspectiveCamera as a}from"three";import{ViewController as r}from"../../services/render.js";import{DecimalInput as h,RestrictedRotationInput as c}from"../../input/index.js";import{PhysicsSystem as d,RayTestResult as m}from"../../services/physics/physics-system.js";import{Parameter as l}from"../../../shader/parameter.js";import{World as p}from"../../services/world.js";import{inject as u}from"../../inject.js";const f=void 0!==window&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);let w=class extends i{constructor(t,e){super(),this.viewController=t,this.physicsSystem=e,this.aspect=this.viewController.htmlElement.clientWidth/this.viewController.htmlElement.clientHeight,this.near=.5,this.far=500,this.viewAngle=f?30:45,this.camera=new a(this.viewAngle,this.aspect,this.near,this.far),this.distance=9,this.minDistance=1.5,this.maxDistance=this.distance,this.height=3,this.offsetX=-1,this.offsetZ=1.5,this.autoActivate=!0,this.bounceBackSpeed=5,this.collisionCheckRadius=.5,this.restrictedDistance=Math.max(this.distance,this.maxDistance),this.rotationInput=new c(-Math.PI/4,Math.PI/2-.7),this.zoomInput=new h(1,0,1),this.offset=new o,this.lookAtOffset=new o(this.offsetX,0,this.offsetZ),this.fixedBehind=!0,this.world=u(p),this.isMouseLocked=!1,this.canvas=null,this.pointerLockInactivatedAt=null,this.onMouseDown=t=>{this.isMouseLocked||"mouse"!==t.pointerType||this.hideCursor()},this.onKeyDown=t=>{"Escape"===t.key&&this.showCursor()},this.onPointerLockChange=()=>{null!=document.pointerLockElement||null!=document.mozPointerLockElement||this.showCursor()}}async onInit(){this.world.scene.add(this.camera),this.rotationInput.rotation.copy(this.actor.rotation),this.restrictedDistance=Math.max(this.distance,this.maxDistance),this.lookAtOffset.set(this.offsetX,0,this.offsetZ),this.autoActivate&&this.activate()}activate(){this.viewController.setCamera(this.camera);const t=this.element;null!=document.body.requestPointerLock&&(t.addEventListener("pointerdown",this.onMouseDown),t.addEventListener("keydown",this.onKeyDown),document.addEventListener("pointerlockchange",this.onPointerLockChange,!1),this.disposed.subscribe((()=>{t.removeEventListener("pointerdown",this.onMouseDown),t.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("pointerlockchange",this.onPointerLockChange,!1)})))}onLateUpdate(t){this.setFromRotation(t)}get element(){return this.viewController.htmlElement}hideCursor(){null!=this.pointerLockInactivatedAt&&performance.now()-this.pointerLockInactivatedAt<1600||(this.element.style.cursor="none",null==this.canvas&&(this.canvas=this.element.getElementsByTagName("canvas")[0]),this.canvas&&(this.canvas.requestPointerLock(),this.isMouseLocked=!0))}showCursor(){this.pointerLockInactivatedAt=performance.now(),this.element.style.cursor="default",window.document.exitPointerLock(),this.isMouseLocked=!1}setFromRotation(t){this.checkForCollision(t);const e=n.clamp(Math.min(this.restrictedDistance,this.distance),Math.min(this.minDistance,this.restrictedDistance),Math.max(this.distance*this.zoomInput.value,this.minDistance)),i=Math.cos(this.rotationInput.rotation.x)*e,s=this.fixedBehind?0:this.rotationInput.rotation.y;this.offset.x=Math.sin(-s)*i,this.offset.y=Math.sin(this.rotationInput.rotation.x)*e+2,this.offset.z=Math.cos(-s)*-i,this.offset.add(this.lookAtOffset),this.updateCameraPosition()}checkForCollision(t){const e=this.getLookAtPosition(),i=y;let s=!1,o=this.distance;const a=new m,r=this.camera.getWorldPosition(g);for(let t=-1;t<=1;t++){const n=k.subVectors(r,e);i.copy(r).add(n.multiplyScalar(1.2)),i.x+=t*this.collisionCheckRadius,this.physicsSystem.rayTest(e,i,a,{debugLifetime:0,excludeActor:this.actor,excludeTriggers:!0}),a.hasHit&&a.distance<this.distance&&(o=Math.min(a.distance,o),s||(s=a.hasHit))}s||(this.restrictedDistance=n.lerp(this.restrictedDistance,this.distance,n.clamp(this.bounceBackSpeed*t,0,1)))}getLookAtPosition(){const t=v;return t.set(0,0,0),t.y=this.height,t.add(this.lookAtOffset),t.applyMatrix4(this.actor.object.matrixWorld),t}updateCameraPosition(){this.fixedBehind?(this.camera.position.set(this.offset.x,this.offset.y,this.offset.z),this.camera.rotation.set(0,0,0),this.camera.scale.set(1,1,1),this.camera.applyMatrix4(this.actor.object.matrix)):this.camera.position.copy(this.actor.position).add(this.offset);const t=this.getLookAtPosition();this.camera.lookAt(t)}};t([l(),e("design:type",Number)],w.prototype,"near",void 0),t([l(),e("design:type",Number)],w.prototype,"far",void 0),t([l(),e("design:type",Number)],w.prototype,"viewAngle",void 0),w=t([s(),e("design:paramtypes",[r,d])],w);export{w as ThirdPersonCameraComponent};const v=new o,y=new o,k=(new o,new o),g=new o;export class ThirdPartyCameraComponent extends w{}/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
@@ -39,3 +39,4 @@ export type ComponentAttachProps<T> = Partial<Omit<{
|
|
39
39
|
}, keyof ActorComponent>>;
|
40
40
|
export declare function Attach<T extends ActorComponent>(props?: ComponentAttachProps<T>, type?: Constructable<T>): (target: Object, propertyName: string | Symbol, index?: number) => void;
|
41
41
|
export declare function attach<T extends ActorComponent>(type: Constructable<T>, props?: ComponentAttachProps<T>): T;
|
42
|
+
//# sourceMappingURL=component.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/gameplay/actors/component.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,aAAa,EAAqB,MAAM,QAAQ,CAAC;AACtF,OAAO,EAAE,SAAS,EAAkC,MAAM,YAAY,CAAA;AAItE,8BAAsB,cAAc,CAAC,SAAS,SAAS,SAAS,GAAG,SAAS;IACnE,KAAK,EAAE,SAAS,CAAA;;IAMvB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,GAAC,IAAI;IAC5B,WAAW,IAAI,IAAI;IACnB,SAAS,IAAI,IAAI;IACjB;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IACjC;;;;OAIG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAErC,IAAI,QAAQ,iCAEX;IAED,SAAS,CAAC,MAAM,CAAC,CAAC,SAAS,cAAc,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,CAAC;CAGvG;AAGD,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;;;;OAOG;IACH,QAAQ,EAAE,OAAO,CAAA;IAEjB,UAAU,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,wBAAgB,SAAS,CAAC,OAAO,GAAE,OAAO,CAAC,gBAAgB,CAAwC,IAEhF,sBAAiB,UAMnC;AAED,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,EAAE,MAAM,cAAc,CAAC,CAAC,CAAA;AAGnG,wBAAgB,MAAM,CAAC,CAAC,SAAS,cAAc,EAAE,KAAK,GAAE,oBAAoB,CAAC,CAAC,CAAM,EAAE,IAAI,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,IAC1F,QAAQ,MAAM,EAAE,cAAc,MAAM,GAAG,MAAM,EAAE,QAAQ,MAAM,KAAG,IAAI,CAetF;AAGD,wBAAgB,MAAM,CAAC,CAAC,SAAS,cAAc,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,CAAC,CAY3G"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import{Container as t,Service as n,Inject as o}from"typedi";import{_setupActorUpdateEventHandlers as e}from"./actor.js";import{activeContainerInstance as r}from"./internal/container-map.js";import{randomString as i}from"../../utils/math.js";export class ActorComponent{constructor(){e.call(this)}onInit(){}onBeginPlay(){}onEndPlay(){}onUpdate(t){}onLateUpdate(t){}get disposed(){return this.actor.disposed}attach(t,n){return this.actor.attach(t,n)}}ActorComponent.__isActorComponent=!0;export function Component(t={inEditor:!1,editorOnly:!1}){const o=n({transient:!0});return function(n){n.__inEditor=t.inEditor,n.__onlyEditor=t.editorOnly,o(n)}}export function Attach(n={},e){return function(r,i,a){if(null==r)return void Reflect.defineMetadata("design:type",e,e.prototype,i);const c=e??Reflect.getMetadata("design:type",r,i);o((()=>c))(r,i,a);const s=t.handlers.find((t=>t.object===r&&t.propertyName===i&&t.index===a)),d=s.value;s.value=t=>{const o=d(t);return Object.assign(o,n)}}}export function attach(n,o){const e=r.value??t.of("default"),a=i();e.set({id:a,type:n,transient:!0});const c=e.get(a);if(null!=o)for(const t of Object.keys(o))c[t]=o[t];return c}
|
2
|
-
/*
|
1
|
+
import{Container as t,Service as n,Inject as o}from"typedi";import{_setupActorUpdateEventHandlers as e}from"./actor.js";import{activeContainerInstance as r}from"./internal/container-map.js";import{randomString as i}from"../../utils/math.js";export class ActorComponent{constructor(){e.call(this)}onInit(){}onBeginPlay(){}onEndPlay(){}onUpdate(t){}onLateUpdate(t){}get disposed(){return this.actor.disposed}attach(t,n){return this.actor.attach(t,n)}}ActorComponent.__isActorComponent=!0;export function Component(t={inEditor:!1,editorOnly:!1}){const o=n({transient:!0});return function(n){n.__inEditor=t.inEditor,n.__onlyEditor=t.editorOnly,o(n)}}export function Attach(n={},e){return function(r,i,a){if(null==r)return void Reflect.defineMetadata("design:type",e,e.prototype,i);const c=e??Reflect.getMetadata("design:type",r,i);o((()=>c))(r,i,a);const s=t.handlers.find((t=>t.object===r&&t.propertyName===i&&t.index===a)),d=s.value;s.value=t=>{const o=d(t);return Object.assign(o,n)}}}export function attach(n,o){const e=r.value??t.of("default"),a=i();e.set({id:a,type:n,transient:!0});const c=e.get(a);if(null!=o)for(const t of Object.keys(o))c[t]=o[t];return c}/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
@@ -10,3 +10,4 @@ export declare class ActorFactory implements ActorProvider<BaseActor> {
|
|
10
10
|
create<T extends BaseActor>(type: Constructable<T>, position?: Vector3, rotation?: Euler, delayInit?: boolean): Promise<T>;
|
11
11
|
initActor(actor: BaseActor): Promise<void>;
|
12
12
|
}
|
13
|
+
//# sourceMappingURL=factory.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/gameplay/actors/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAA;AAEzD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAMvC,qBACa,YAAa,YAAW,aAAa,CAAC,SAAS,CAAC;IAC/C,OAAO,CAAC,SAAS;IAAqB,OAAO,CAAC,GAAG;gBAAzC,SAAS,EAAE,iBAAiB,EAAU,GAAG,EAAE,iBAAiB;IACnE,MAAM,CAAC,CAAC,SAAS,SAAS,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAiC1H,SAAS,CAAC,KAAK,EAAE,SAAS;CAMxC"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import{__decorate as t,__metadata as i}from"tslib";import{ContainerInstance as n}from"typedi";import{Service as o}from"typedi";import{initComponents as e}from"./internal/component-init.js";import{activeContainerInstance as r,containerRefMap as a}from"./internal/container-map.js";let s=class{constructor(t,i){this.container=t,this.env=i}async create(t,i,n,o){const e=this.container;r.value=e;const s=(1e4*Math.random()).toString();e.set({id:s,type:t,transient:!0});const c=e.get(s);return r.value=null,e.remove(t),a.set(c,e),i&&c.object.position.copy(i),n&&c.object.rotation.copy(n),!0!==o&&await this.initActor(c),c}async initActor(t){await e(t,t,this.env.inEditor??!1),await t.onInit(),t.__isInitialised=!0}};s=t([o(),i("design:paramtypes",[n,Object])],s);export{s as ActorFactory}
|
2
|
-
/*
|
1
|
+
import{__decorate as t,__metadata as i}from"tslib";import{ContainerInstance as n}from"typedi";import{Service as o}from"typedi";import{initComponents as e}from"./internal/component-init.js";import{activeContainerInstance as r,containerRefMap as a}from"./internal/container-map.js";let s=class{constructor(t,i){this.container=t,this.env=i}async create(t,i,n,o){const e=this.container;r.value=e;const s=(1e4*Math.random()).toString();e.set({id:s,type:t,transient:!0});const c=e.get(s);return r.value=null,e.remove(t),a.set(c,e),i&&c.object.position.copy(i),n&&c.object.rotation.copy(n),!0!==o&&await this.initActor(c),c}async initActor(t){await e(t,t,this.env.inEditor??!1),await t.onInit(),t.__isInitialised=!0}};s=t([o(),i("design:paramtypes",[n,Object])],s);export{s as ActorFactory};/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
@@ -8,3 +8,4 @@ export * from './builtin/components/mesh-component.js';
|
|
8
8
|
export * from './builtin/components/character/character-movement.js';
|
9
9
|
export * from './builtin/components/character/modes.js';
|
10
10
|
export * from './builtin/components/character/character-animation.js';
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/gameplay/actors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AAC9D,OAAO,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAA;AACjH,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACnF,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAA;AACpG,cAAc,wCAAwC,CAAA;AACtD,cAAc,sDAAsD,CAAA;AACpE,cAAc,yCAAyC,CAAA;AACvD,cAAc,uDAAuD,CAAA"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
export{CameraActor}from"./builtin/camera-actor.js";export{CameraComponent}from"./camera/camera-component.js";export{ThirdPersonCameraComponent,ThirdPartyCameraComponent}from"./camera/third-person-camera-component.js";export{SpawnPoint}from"./builtin/spawn-point.js";export{TriggerVolume,TriggerVolumeComponent}from"./builtin/trigger-volume.js";export{PositionalAudioActor,PositionalAudioComponent}from"./builtin/positional-audio-actor.js";export*from"./builtin/components/mesh-component.js";export*from"./builtin/components/character/character-movement.js";export*from"./builtin/components/character/modes.js";export*from"./builtin/components/character/character-animation.js"
|
2
|
-
/*
|
1
|
+
export{CameraActor}from"./builtin/camera-actor.js";export{CameraComponent}from"./camera/camera-component.js";export{ThirdPersonCameraComponent,ThirdPartyCameraComponent}from"./camera/third-person-camera-component.js";export{SpawnPoint}from"./builtin/spawn-point.js";export{TriggerVolume,TriggerVolumeComponent}from"./builtin/trigger-volume.js";export{PositionalAudioActor,PositionalAudioComponent}from"./builtin/positional-audio-actor.js";export*from"./builtin/components/mesh-component.js";export*from"./builtin/components/character/character-movement.js";export*from"./builtin/components/character/modes.js";export*from"./builtin/components/character/character-animation.js";/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"component-init.d.ts","sourceRoot":"","sources":["../../../../src/gameplay/actors/internal/component-init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAIhD,wBAAsB,cAAc,CAAC,CAAC,EAAE,SAAS,GAAC,cAAc,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,UAAQ,kBAoCnG"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import{ActorComponent as o}from"../component.js";const n=new WeakMap;export async function initComponents(t,c,i=!1){const r=[];for(const s of Object.values(t))if(s instanceof o||null!=s?.constructor&&!0===s.constructor.__isActorComponent){if(i&&!s.constructor.__inEditor)continue;if(!i&&s.constructor.__onlyEditor)continue;const o=s;if(o.actor=c,n.has(o))continue;n.set(o,!0),await o.onInit(),r.push(initComponents(s,c,i))}return Promise.all(r)}
|
2
|
-
/*
|
1
|
+
import{ActorComponent as o}from"../component.js";const n=new WeakMap;export async function initComponents(t,c,i=!1){const r=[];for(const s of Object.values(t))if(s instanceof o||null!=s?.constructor&&!0===s.constructor.__isActorComponent){if(i&&!s.constructor.__inEditor)continue;if(!i&&s.constructor.__onlyEditor)continue;const o=s;if(o.actor=c,n.has(o))continue;n.set(o,!0),await o.onInit(),r.push(initComponents(s,c,i))}return Promise.all(r)}/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"container-map.d.ts","sourceRoot":"","sources":["../../../../src/gameplay/actors/internal/container-map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,eAAO,MAAM,eAAe,uCAA8C,CAAA;AAE1E,eAAO,MAAM,uBAAuB;;CAEnC,CAAA"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
export const containerRefMap=new WeakMap;export const activeContainerInstance={value:null}
|
2
|
-
/*
|
1
|
+
export const containerRefMap=new WeakMap;export const activeContainerInstance={value:null};/*
|
3
2
|
* Copyright (©) 2023. All rights reserved.
|
4
3
|
* See the LICENSE.md file for details.
|
5
4
|
*/
|