gaesup-world 0.0.71 → 0.0.73

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.
@@ -15,12 +15,20 @@ import { useContext, useEffect } from "react";
15
15
  import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../world/context";
16
16
  export function usePlayActions() {
17
17
  var _a = useContext(GaesupWorldContext), characterGltf = _a.characterGltf, vehicleGltf = _a.vehicleGltf, airplaneGltf = _a.airplaneGltf, animations = _a.animations;
18
- var characterAnimations = characterGltf.animations;
19
- var characterResult = useAnimations(characterAnimations);
20
- var vehicleAnimations = vehicleGltf.animations;
21
- var vehicleResult = useAnimations(vehicleAnimations);
22
- var airplaneAnimations = airplaneGltf.animations;
23
- var airplaneResult = useAnimations(airplaneAnimations);
18
+ var resultRef = {
19
+ character: null,
20
+ vehicle: null,
21
+ airplane: null,
22
+ };
23
+ if (characterGltf && characterGltf.animations) {
24
+ resultRef.character = useAnimations(characterGltf.animations);
25
+ }
26
+ if (vehicleGltf && vehicleGltf.animations) {
27
+ resultRef.vehicle = useAnimations(vehicleGltf.animations);
28
+ }
29
+ if (airplaneGltf && airplaneGltf.animations) {
30
+ resultRef.airplane = useAnimations(airplaneGltf.animations);
31
+ }
24
32
  var dispatch = useContext(GaesupWorldDispatchContext);
25
33
  var play = function (tag) {
26
34
  animations.current = tag;
@@ -43,11 +51,6 @@ export function usePlayActions() {
43
51
  },
44
52
  });
45
53
  };
46
- var resultRef = {
47
- character: characterResult,
48
- vehicle: vehicleResult,
49
- airplane: airplaneResult,
50
- };
51
54
  return { resultRef: resultRef, play: play, setAnimationName: setAnimationName };
52
55
  }
53
56
  export default function playCharacterActions(_a) {
@@ -4,6 +4,6 @@ export default function normal(prop) {
4
4
  var cameraPosition = activeState.position
5
5
  .clone()
6
6
  .add(V3(0, perspectiveCamera.YDistance, perspectiveCamera.XZDistance));
7
- state.camera.position.lerp(cameraPosition, 1);
7
+ state.camera.position.lerp(cameraPosition, 0.9);
8
8
  state.camera.lookAt(activeState.position.clone());
9
9
  }
@@ -19,7 +19,6 @@ import { GaesupWorldContext } from "../world/context";
19
19
  import mapControl from "./control/map";
20
20
  import normal from "./control/normal";
21
21
  import orbit from "./control/orbit";
22
- import detector from "./detector";
23
22
  export default function Camera(_a) {
24
23
  var refs = _a.refs, prop = _a.prop, control = _a.control;
25
24
  var worldContext = useContext(GaesupWorldContext);
@@ -67,7 +66,7 @@ export default function Camera(_a) {
67
66
  var distV3 = camera.position.clone().sub(activeState.position);
68
67
  cameraRay.origin.copy(camera.position);
69
68
  cameraRay.dir.copy(distV3.negate().normalize());
70
- detector(cameraProp);
69
+ // detector(cameraProp);
71
70
  });
72
71
  return (_jsxs(_Fragment, { children: [cameraMode.cameraType === "perspective" && (_jsxs(_Fragment, { children: [_jsx(OrbitControls, { target: activeState.position }), _jsx(PerspectiveCamera, __assign({ makeDefault: true }, perspectiveCamera))] })), cameraMode.cameraType === "orthographic" && (_jsxs(_Fragment, { children: [_jsx(MapControls, { target: activeState.position }), _jsx(OrthographicCamera, __assign({ makeDefault: true }, orthographicCamera))] }))] }));
73
72
  }
@@ -11,6 +11,6 @@ export declare function gaesupControllerReducer(props: gaesupControllerType, act
11
11
  vehicle: import("./type").vehicleType;
12
12
  character: import("./type").characterType;
13
13
  isRider: boolean;
14
- callbacks: import("../initialize/callback/type").callbackType;
15
- refs: import("../type").refsType;
14
+ callbacks?: import("../initialize/callback/type").callbackType;
15
+ refs?: import("../type").refsType;
16
16
  };
@@ -62,10 +62,10 @@ export type orthographicCameraDebugType = {
62
62
  far?: number;
63
63
  };
64
64
  export type perspectiveCameraPropType = {
65
- isFront: boolean;
65
+ isFront?: boolean;
66
66
  } & perspectiveCameraDebugType;
67
67
  export type gaesupControllerType = gaesupControllerContextPropType & {
68
- callbacks: callbackType;
69
- refs: refsType;
68
+ callbacks?: callbackType;
69
+ refs?: refsType;
70
70
  };
71
71
  export type gaesupDisptachType = dispatchType<gaesupControllerType>;
@@ -19,19 +19,20 @@ export default function initControllerProps(_a) {
19
19
  var controllerContext = _a.controllerContext, refs = _a.refs;
20
20
  var context = useContext(GaesupWorldContext);
21
21
  var dispatch = useContext(GaesupWorldDispatchContext);
22
- var _b = useContext(GaesupWorldContext), control = _b.control, mode = _b.mode;
23
- var _c = useKeyboardControls(), _ = _c[0], getKeys = _c[1];
22
+ var _b = useKeyboardControls(), _ = _b[0], getKeys = _b[1];
24
23
  var keyControl = getKeys();
25
24
  useEffect(function () {
26
- if (keyControl && control) {
25
+ if (context && keyControl && context.control) {
27
26
  dispatch({
28
27
  type: "update",
29
28
  payload: {
30
- control: __assign({}, (mode.controller === "keyboard" ? keyControl : control)),
29
+ control: __assign({}, (context.mode.controller === "keyboard"
30
+ ? keyControl
31
+ : context.control)),
31
32
  },
32
33
  });
33
34
  }
34
- }, [mode.controller, keyControl, control]);
35
+ }, [context.mode.controller, keyControl, context.control]);
35
36
  var groundRay = useMemo(function () {
36
37
  return {
37
38
  origin: vec3(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gaesup-world",
3
- "version": "0.0.71",
3
+ "version": "0.0.73",
4
4
  "type": "commonjs",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",