gaesup-world 0.0.64 → 0.0.66

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.
Files changed (133) hide show
  1. package/dist/gaesup/animation/actions.js +42 -29
  2. package/dist/gaesup/camera/cameraCollisionDetecter.js +2 -2
  3. package/dist/gaesup/camera/control/map.js +2 -2
  4. package/dist/gaesup/camera/control/normal.js +2 -2
  5. package/dist/gaesup/camera/control/orbit.js +2 -2
  6. package/dist/gaesup/camera/index.js +28 -19
  7. package/dist/gaesup/component/Airplane.js +3 -2
  8. package/dist/gaesup/component/Character.js +3 -2
  9. package/dist/gaesup/component/Vehicle.js +3 -2
  10. package/dist/gaesup/component/gltf/AirplaneGltf.js +4 -4
  11. package/dist/gaesup/component/gltf/CharacterGltf.js +22 -10
  12. package/dist/gaesup/component/gltf/VehicleGltf.js +4 -4
  13. package/dist/gaesup/component/gltf/WheelJoint.js +11 -10
  14. package/dist/gaesup/component/ref/airplane.js +26 -12
  15. package/dist/gaesup/component/ref/character.js +27 -12
  16. package/dist/gaesup/component/ref/vehicle.js +24 -10
  17. package/dist/gaesup/component/setInit.js +2 -2
  18. package/dist/gaesup/controller/context/index.js +14 -3
  19. package/dist/gaesup/controller/context/reducer.js +13 -2
  20. package/dist/gaesup/controller/index.d.ts +1 -1
  21. package/dist/gaesup/controller/index.js +35 -25
  22. package/dist/gaesup/gaesupProps/index.d.ts +1 -1
  23. package/dist/gaesup/gaesupProps/index.js +36 -15
  24. package/dist/gaesup/index.d.ts +4 -4
  25. package/dist/gaesup/index.js +4 -4
  26. package/dist/gaesup/initial/callback/index.js +26 -16
  27. package/dist/gaesup/initial/controller/index.js +34 -22
  28. package/dist/gaesup/initial/controller/initDebug.js +13 -2
  29. package/dist/gaesup/initial/gaesupWorld/collider/airplane.js +5 -4
  30. package/dist/gaesup/initial/gaesupWorld/collider/character.js +14 -13
  31. package/dist/gaesup/initial/gaesupWorld/collider/gltf.js +17 -16
  32. package/dist/gaesup/initial/gaesupWorld/collider/index.js +4 -4
  33. package/dist/gaesup/initial/gaesupWorld/collider/vehicle.js +5 -4
  34. package/dist/gaesup/initial/gaesupWorld/index.js +19 -8
  35. package/dist/gaesup/physics/airplane/currentSetting.js +13 -2
  36. package/dist/gaesup/physics/airplane/damping.js +1 -1
  37. package/dist/gaesup/physics/airplane/direction.js +16 -16
  38. package/dist/gaesup/physics/airplane/gravity.js +1 -1
  39. package/dist/gaesup/physics/airplane/impulse.js +4 -4
  40. package/dist/gaesup/physics/airplane/turn.js +1 -1
  41. package/dist/gaesup/physics/character/accelaration.js +4 -4
  42. package/dist/gaesup/physics/character/currentSetting.js +13 -2
  43. package/dist/gaesup/physics/character/damping.js +1 -1
  44. package/dist/gaesup/physics/character/direction.js +13 -11
  45. package/dist/gaesup/physics/character/impulse.js +5 -5
  46. package/dist/gaesup/physics/character/jump.js +3 -3
  47. package/dist/gaesup/physics/character/stabilizing.js +1 -1
  48. package/dist/gaesup/physics/character/turn.js +2 -2
  49. package/dist/gaesup/physics/check/ground.js +1 -1
  50. package/dist/gaesup/physics/check/moving.js +2 -2
  51. package/dist/gaesup/physics/check/rotate.js +1 -1
  52. package/dist/gaesup/physics/check/slope.js +3 -3
  53. package/dist/gaesup/physics/index.js +19 -13
  54. package/dist/gaesup/physics/vehicle/currentSetting.js +13 -2
  55. package/dist/gaesup/physics/vehicle/damping.js +3 -3
  56. package/dist/gaesup/physics/vehicle/direction.js +6 -6
  57. package/dist/gaesup/physics/vehicle/impulse.js +7 -7
  58. package/dist/gaesup/physics/vehicle/turn.js +1 -1
  59. package/dist/gaesup/styles.css.js +2 -2
  60. package/dist/gaesup/tools/context.js +2 -2
  61. package/dist/gaesup/tools/gameboy/GameBoyButton.js +9 -8
  62. package/dist/gaesup/tools/gameboy/default.js +1 -1
  63. package/dist/gaesup/tools/gameboy/index.js +3 -3
  64. package/dist/gaesup/tools/gameboy/style.css.js +4 -3
  65. package/dist/gaesup/tools/gamepad/GamePadButton.js +9 -8
  66. package/dist/gaesup/tools/gamepad/default.js +1 -1
  67. package/dist/gaesup/tools/gamepad/index.js +10 -8
  68. package/dist/gaesup/tools/gamepad/style.css.js +3 -3
  69. package/dist/gaesup/tools/index.d.ts +1 -1
  70. package/dist/gaesup/tools/index.js +12 -13
  71. package/dist/gaesup/tools/joystick/default.js +26 -15
  72. package/dist/gaesup/tools/joystick/index.js +58 -47
  73. package/dist/gaesup/tools/joystick/style.css.js +15 -13
  74. package/dist/gaesup/tools/jumpPoint/index.js +3 -3
  75. package/dist/gaesup/tools/jumpPoint/style.css.js +2 -2
  76. package/dist/gaesup/tools/keyBoardToolTip/constant.js +19 -8
  77. package/dist/gaesup/tools/keyBoardToolTip/default.js +2 -2
  78. package/dist/gaesup/tools/keyBoardToolTip/index.js +23 -23
  79. package/dist/gaesup/tools/keyBoardToolTip/style.css.js +3 -3
  80. package/dist/gaesup/tools/minimap/default.js +2 -2
  81. package/dist/gaesup/tools/minimap/index.js +32 -20
  82. package/dist/gaesup/tools/minimap/style.css.js +12 -12
  83. package/dist/gaesup/tools/pushKey/index.js +16 -5
  84. package/dist/gaesup/tools/reducer.js +13 -2
  85. package/dist/gaesup/tools/style.css.js +3 -3
  86. package/dist/gaesup/utils/constant.js +1 -1
  87. package/dist/gaesup/utils/ray.js +3 -2
  88. package/dist/gaesup/utils/ref.js +4 -3
  89. package/dist/gaesup/world/context/index.js +3 -3
  90. package/dist/gaesup/world/context/reducer.js +13 -2
  91. package/dist/gaesup/world/index.d.ts +1 -1
  92. package/dist/gaesup/world/index.js +2 -2
  93. package/dist/styles/constants/boxshadow.css.js +2 -2
  94. package/dist/styles/constants/constant.css.js +6 -6
  95. package/dist/styles/constants/direction.css.js +3 -3
  96. package/dist/styles/constants/flex.css.js +6 -6
  97. package/dist/styles/constants/gradient.css.js +1 -1
  98. package/dist/styles/constants/grid.css.js +15 -4
  99. package/dist/styles/constants/palette.css.js +26 -26
  100. package/dist/styles/constants/translate.css.js +15 -4
  101. package/dist/styles/recipe/base.css.js +6 -6
  102. package/dist/styles/recipe/button.css.js +4 -4
  103. package/dist/styles/recipe/index.css.js +31 -20
  104. package/dist/styles/recipe/input.css.js +1 -1
  105. package/dist/styles/sprinkles/color.css.js +15 -4
  106. package/dist/styles/sprinkles/direction.css.js +13 -2
  107. package/dist/styles/sprinkles/display.css.js +1 -1
  108. package/dist/styles/sprinkles/fontSize.css.js +13 -2
  109. package/dist/styles/sprinkles/grid.css.js +1 -1
  110. package/dist/styles/sprinkles/index.css.js +1 -1
  111. package/dist/styles/sprinkles/margin.css.js +13 -2
  112. package/dist/styles/sprinkles/padding.css.js +13 -2
  113. package/dist/styles/sprinkles/position.css.js +1 -1
  114. package/dist/styles/sprinkles/size.css.js +13 -2
  115. package/dist/styles/theme.css.js +15 -4
  116. package/index.ts +7 -0
  117. package/package.json +6 -11
  118. package/src/gaesup/controller/index.tsx +1 -3
  119. package/src/gaesup/gaesupProps/index.tsx +1 -1
  120. package/src/gaesup/index.ts +4 -4
  121. package/src/gaesup/tools/gameboy/index.tsx +8 -2
  122. package/src/gaesup/tools/gameboy/style.css.ts +1 -0
  123. package/src/gaesup/tools/gamepad/GamePadButton.tsx +1 -1
  124. package/src/gaesup/tools/gamepad/index.tsx +8 -2
  125. package/src/gaesup/tools/index.tsx +2 -6
  126. package/src/gaesup/tools/joystick/index.tsx +4 -201
  127. package/src/gaesup/tools/joystick/style.css.ts +12 -10
  128. package/src/gaesup/tools/keyBoardToolTip/index.tsx +15 -12
  129. package/src/gaesup/tools/minimap/index.tsx +20 -16
  130. package/src/gaesup/world/index.tsx +1 -1
  131. package/tsconfig.build.json +22 -0
  132. package/tsconfig.json +2 -3
  133. package/lib/index.ts +0 -10
@@ -1,66 +1,79 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
1
12
  import { useAnimations, useKeyboardControls } from "@react-three/drei";
2
13
  import { useFrame } from "@react-three/fiber";
3
14
  import { useContext, useEffect } from "react";
4
15
  import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../world/context";
5
- export default function playActions({ outerGroupRef, groundRay, isRider, }) {
6
- const { characterGltf, animations: characterAnimations } = useContext(GaesupWorldContext);
7
- const dispatch = useContext(GaesupWorldDispatchContext);
8
- const { animations } = characterGltf;
9
- const control = useKeyboardControls()[1]();
10
- const { actions } = useAnimations(animations, outerGroupRef);
11
- useEffect(() => {
16
+ export default function playActions(_a) {
17
+ var outerGroupRef = _a.outerGroupRef, groundRay = _a.groundRay, isRider = _a.isRider;
18
+ var _b = useContext(GaesupWorldContext), characterGltf = _b.characterGltf, characterAnimations = _b.animations;
19
+ var dispatch = useContext(GaesupWorldDispatchContext);
20
+ var animations = characterGltf.animations;
21
+ var control = useKeyboardControls()[1]();
22
+ var actions = useAnimations(animations, outerGroupRef).actions;
23
+ useEffect(function () {
12
24
  characterAnimations.keyControl = control;
13
25
  dispatch({
14
26
  type: "update",
15
27
  payload: {
16
- animations: Object.assign({}, characterAnimations),
28
+ animations: __assign({}, characterAnimations),
17
29
  },
18
30
  });
19
31
  }, [control]);
20
- const playAnimation = (tag) => {
32
+ var playAnimation = function (tag) {
21
33
  characterAnimations.current = tag;
22
34
  dispatch({
23
35
  type: "update",
24
36
  payload: {
25
- animations: Object.assign({}, characterAnimations),
37
+ animations: __assign({}, characterAnimations),
26
38
  },
27
39
  });
28
40
  };
29
- const setAnimationName = (actions) => {
30
- characterAnimations.animationNames = Object.assign(characterAnimations.animationNames, Object.keys(actions).reduce((acc, cur) => {
31
- return Object.assign(Object.assign({}, acc), { [cur]: cur });
41
+ var setAnimationName = function (actions) {
42
+ characterAnimations.animationNames = Object.assign(characterAnimations.animationNames, Object.keys(actions).reduce(function (acc, cur) {
43
+ var _a;
44
+ return __assign(__assign({}, acc), (_a = {}, _a[cur] = cur, _a));
32
45
  }, {}));
33
46
  dispatch({
34
47
  type: "update",
35
48
  payload: {
36
- animations: Object.assign({}, characterAnimations),
49
+ animations: __assign({}, characterAnimations),
37
50
  },
38
51
  });
39
52
  };
40
- const resetAni = () => playAnimation("idle");
41
- const playIdle = () => playAnimation("idle");
42
- const playWalk = () => playAnimation("walk");
43
- const playRun = () => playAnimation("run");
44
- const playJump = () => playAnimation("jump");
45
- const playFall = () => playAnimation("fall");
46
- const playRide = () => playAnimation("ride");
47
- useEffect(() => {
48
- return () => {
53
+ var resetAni = function () { return playAnimation("idle"); };
54
+ var playIdle = function () { return playAnimation("idle"); };
55
+ var playWalk = function () { return playAnimation("walk"); };
56
+ var playRun = function () { return playAnimation("run"); };
57
+ var playJump = function () { return playAnimation("jump"); };
58
+ var playFall = function () { return playAnimation("fall"); };
59
+ var playRide = function () { return playAnimation("ride"); };
60
+ useEffect(function () {
61
+ return function () {
49
62
  resetAni();
50
63
  };
51
64
  }, []);
52
- useEffect(() => {
65
+ useEffect(function () {
53
66
  var _a;
54
67
  // Play animation
55
- const action = (_a = actions[characterAnimations.current]) === null || _a === void 0 ? void 0 : _a.reset().fadeIn(0.2).play();
68
+ var action = (_a = actions[characterAnimations.current]) === null || _a === void 0 ? void 0 : _a.reset().fadeIn(0.2).play();
56
69
  setAnimationName(actions);
57
- return () => {
70
+ return function () {
58
71
  action === null || action === void 0 ? void 0 : action.fadeOut(0.2);
59
72
  };
60
73
  }, [characterAnimations.current]);
61
- const { states, activeState } = useContext(GaesupWorldContext);
62
- const { isNotMoving, isMoving, isJumping, isRunning, isAnimationOuter } = states;
63
- useFrame(() => {
74
+ var _c = useContext(GaesupWorldContext), states = _c.states, activeState = _c.activeState;
75
+ var isNotMoving = states.isNotMoving, isMoving = states.isMoving, isJumping = states.isJumping, isRunning = states.isRunning, isAnimationOuter = states.isAnimationOuter;
76
+ useFrame(function () {
64
77
  if (isRider) {
65
78
  playRide();
66
79
  }
@@ -1,7 +1,7 @@
1
1
  export default function cameraCollisionDetector(prop) {
2
2
  // const { cameraRay, constant, options } = prop;
3
3
  // const { camera } = useThree();
4
- const checkCollision = (delta) => {
4
+ var checkCollision = function (delta) {
5
5
  // cameraRay.origin.copy(cameraRay.pivot.position);
6
6
  // camera.getWorldPosition(cameraRay.position);
7
7
  // cameraRay.dir.subVectors(cameraRay.position, cameraRay.pivot.position);
@@ -46,5 +46,5 @@ export default function cameraCollisionDetector(prop) {
46
46
  //
47
47
  // cameraRay.followCamera.position.lerp(cameraRay.lerpingPoint, delta * 4);
48
48
  };
49
- return { checkCollision };
49
+ return { checkCollision: checkCollision };
50
50
  }
@@ -1,5 +1,5 @@
1
1
  export default function mapControl(prop) {
2
- const { state, worldContext: { activeState }, } = prop;
3
- const position = activeState.position.clone();
2
+ var state = prop.state, activeState = prop.worldContext.activeState;
3
+ var position = activeState.position.clone();
4
4
  state.camera.position.set(-10, 10, -10).add(position);
5
5
  }
@@ -1,7 +1,7 @@
1
1
  import { V3 } from "../../utils/vector";
2
2
  export default function normal(prop) {
3
- const { state, controllerContext: { perspectiveCamera }, worldContext: { activeState }, } = prop;
4
- const cameraPosition = activeState.position
3
+ var state = prop.state, perspectiveCamera = prop.controllerContext.perspectiveCamera, activeState = prop.worldContext.activeState;
4
+ var cameraPosition = activeState.position
5
5
  .clone()
6
6
  .add(V3(perspectiveCamera.XZDistance, perspectiveCamera.YDistance, 0));
7
7
  state.camera.position.lerp(cameraPosition, 1);
@@ -1,8 +1,8 @@
1
1
  import { quat } from "@react-three/rapier";
2
2
  import { V3 } from "../../utils/vector";
3
3
  export default function orbit(prop) {
4
- const { state, controllerContext: { perspectiveCamera }, worldContext: { activeState }, } = prop;
5
- const cameraPosition = activeState.position.clone().add(V3(Math.sin(activeState.euler.y), 0, Math.cos(activeState.euler.y))
4
+ var state = prop.state, perspectiveCamera = prop.controllerContext.perspectiveCamera, activeState = prop.worldContext.activeState;
5
+ var cameraPosition = activeState.position.clone().add(V3(Math.sin(activeState.euler.y), 0, Math.cos(activeState.euler.y))
6
6
  .normalize()
7
7
  .clone()
8
8
  .multiplyScalar(perspectiveCamera.XZDistance)
@@ -1,3 +1,14 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
1
12
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
13
  import { MapControls, OrbitControls, OrthographicCamera, PerspectiveCamera, } from "@react-three/drei";
3
14
  import { useFrame, useThree } from "@react-three/fiber";
@@ -9,32 +20,30 @@ import cameraCollisionDetector from "./cameraCollisionDetecter";
9
20
  import mapControl from "./control/map";
10
21
  import normal from "./control/normal";
11
22
  import orbit from "./control/orbit";
12
- export default function Camera({ refs, prop, control, }) {
13
- const worldContext = useContext(GaesupWorldContext);
14
- const controllerContext = useContext(GaesupControllerContext);
15
- const { cameraMode, perspectiveCamera, orthographicCamera } = controllerContext;
16
- const { rigidBodyRef, outerGroupRef } = refs;
17
- const { cameraRay } = prop;
18
- const { checkCollision } = cameraCollisionDetector(prop);
19
- const { scene } = useThree();
20
- const { activeState } = worldContext;
21
- const intersectObjectMap = {};
22
- const cameraProp = Object.assign(Object.assign({}, prop), { checkCollision,
23
- control,
24
- controllerContext,
25
- worldContext });
26
- const getMeshs = (object) => {
23
+ export default function Camera(_a) {
24
+ var refs = _a.refs, prop = _a.prop, control = _a.control;
25
+ var worldContext = useContext(GaesupWorldContext);
26
+ var controllerContext = useContext(GaesupControllerContext);
27
+ var cameraMode = controllerContext.cameraMode, perspectiveCamera = controllerContext.perspectiveCamera, orthographicCamera = controllerContext.orthographicCamera;
28
+ var rigidBodyRef = refs.rigidBodyRef, outerGroupRef = refs.outerGroupRef;
29
+ var cameraRay = prop.cameraRay;
30
+ var checkCollision = cameraCollisionDetector(prop).checkCollision;
31
+ var scene = useThree().scene;
32
+ var activeState = worldContext.activeState;
33
+ var intersectObjectMap = {};
34
+ var cameraProp = __assign(__assign({}, prop), { checkCollision: checkCollision, control: control, controllerContext: controllerContext, worldContext: worldContext });
35
+ var getMeshs = function (object) {
27
36
  if (object.userData && object.userData.intangible)
28
37
  return;
29
38
  if (object instanceof THREE.Mesh &&
30
39
  object.geometry.type !== "InstancedBufferGeometry") {
31
40
  intersectObjectMap[object.uuid] = object;
32
41
  }
33
- object.children.forEach((child) => {
42
+ object.children.forEach(function (child) {
34
43
  getMeshs(child);
35
44
  });
36
45
  };
37
- useFrame((state, delta) => {
46
+ useFrame(function (state, delta) {
38
47
  if (!rigidBodyRef ||
39
48
  !rigidBodyRef.current ||
40
49
  !outerGroupRef ||
@@ -43,7 +52,7 @@ export default function Camera({ refs, prop, control, }) {
43
52
  cameraProp.state = state;
44
53
  cameraProp.delta = delta;
45
54
  if (cameraMode.cameraType === "perspective") {
46
- scene.children.forEach((child) => getMeshs(child));
55
+ scene.children.forEach(function (child) { return getMeshs(child); });
47
56
  cameraRay.intersectObjectMap = intersectObjectMap;
48
57
  if (cameraMode.controlType === "orbit") {
49
58
  orbit(cameraProp);
@@ -56,5 +65,5 @@ export default function Camera({ refs, prop, control, }) {
56
65
  mapControl(cameraProp);
57
66
  }
58
67
  });
59
- return (_jsxs(_Fragment, { children: [cameraMode.cameraType === "perspective" && (_jsxs(_Fragment, { children: [_jsx(OrbitControls, { target: activeState.position }), _jsx(PerspectiveCamera, Object.assign({ makeDefault: true }, perspectiveCamera))] })), cameraMode.cameraType === "orthographic" && (_jsxs(_Fragment, { children: [_jsx(MapControls, { target: activeState.position }), _jsx(OrthographicCamera, Object.assign({ makeDefault: true }, orthographicCamera))] }))] }));
68
+ 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))] }))] }));
60
69
  }
@@ -5,8 +5,9 @@ import { AirplaneInnerGroupRef } from "./gltf/AirplaneGltf";
5
5
  import { CharacterInnerGroupRef } from "./gltf/CharacterGltf";
6
6
  import { AirplaneCollider, AirplaneGroup, AirplaneRigidBody, } from "./ref/airplane";
7
7
  import setInit from "./setInit";
8
- export function Airplane({ controllerProps, refs, }) {
9
- const { rigidBodyRef, outerGroupRef, capsuleColliderRef, innerGroupRef, characterInnerRef, } = refs;
8
+ export function Airplane(_a) {
9
+ var controllerProps = _a.controllerProps, refs = _a.refs;
10
+ var rigidBodyRef = refs.rigidBodyRef, outerGroupRef = refs.outerGroupRef, capsuleColliderRef = refs.capsuleColliderRef, innerGroupRef = refs.innerGroupRef, characterInnerRef = refs.characterInnerRef;
10
11
  calculation(controllerProps);
11
12
  setInit(rigidBodyRef);
12
13
  return (_jsx(_Fragment, { children: _jsx(AirplaneGroup, { ref: outerGroupRef, controllerProps: controllerProps, children: _jsxs(AirplaneRigidBody, { ref: rigidBodyRef, controllerProps: controllerProps, children: [_jsx(AirplaneCollider, { prop: controllerProps, ref: capsuleColliderRef }), controllerProps.isRider && (_jsx(CharacterInnerGroupRef, { prop: controllerProps, groupProps: controllerProps.groupProps, groundRay: controllerProps.groundRay, refs: refs, callbacks: controllerProps.callbacks, isRider: controllerProps.isRider, ref: characterInnerRef })), _jsx(AirplaneInnerGroupRef, { ref: innerGroupRef })] }) }) }));
@@ -4,8 +4,9 @@ import calculation from "../physics";
4
4
  import { CharacterInnerGroupRef, InnerGroupRef } from "./gltf/CharacterGltf";
5
5
  import { CharacterCapsuleCollider, CharacterGroup, CharacterRigidBody, CharacterSlopeRay, } from "./ref/character";
6
6
  import setInit from "./setInit";
7
- export function Character({ controllerProps, refs, }) {
8
- const { capsuleColliderRef, rigidBodyRef, outerGroupRef, slopeRayOriginRef, characterInnerRef, innerGroupRef, } = refs;
7
+ export function Character(_a) {
8
+ var controllerProps = _a.controllerProps, refs = _a.refs;
9
+ var capsuleColliderRef = refs.capsuleColliderRef, rigidBodyRef = refs.rigidBodyRef, outerGroupRef = refs.outerGroupRef, slopeRayOriginRef = refs.slopeRayOriginRef, characterInnerRef = refs.characterInnerRef, innerGroupRef = refs.innerGroupRef;
9
10
  calculation(controllerProps);
10
11
  setInit(rigidBodyRef);
11
12
  return (_jsxs(CharacterRigidBody, { ref: rigidBodyRef, controllerProps: controllerProps, children: [_jsx(CharacterCapsuleCollider, { prop: controllerProps, ref: capsuleColliderRef }), _jsxs(CharacterGroup, { ref: outerGroupRef, controllerProps: controllerProps, children: [_jsx(CharacterSlopeRay, { slopeRay: controllerProps.slopeRay, groundRay: controllerProps.groundRay, ref: slopeRayOriginRef }), controllerProps.children, _jsx(InnerGroupRef, { ref: innerGroupRef }), _jsx(CharacterInnerGroupRef, { prop: controllerProps, groupProps: controllerProps.groupProps, groundRay: controllerProps.groundRay, refs: refs, callbacks: controllerProps.callbacks, ref: characterInnerRef, isRider: false })] })] }));
@@ -6,8 +6,9 @@ import { VehicleInnerGroupRef } from "./gltf/VehicleGltf";
6
6
  import { Wheels } from "./gltf/WheelJoint";
7
7
  import { VehicleCollider, VehicleGroup, VehicleRigidBody } from "./ref/vehicle";
8
8
  import setInit from "./setInit";
9
- export function Vehicle({ controllerProps, refs, }) {
10
- const { rigidBodyRef, outerGroupRef, characterInnerRef, innerGroupRef } = refs;
9
+ export function Vehicle(_a) {
10
+ var controllerProps = _a.controllerProps, refs = _a.refs;
11
+ var rigidBodyRef = refs.rigidBodyRef, outerGroupRef = refs.outerGroupRef, characterInnerRef = refs.characterInnerRef, innerGroupRef = refs.innerGroupRef;
11
12
  calculation(controllerProps);
12
13
  setInit(rigidBodyRef);
13
14
  return (_jsxs(VehicleGroup, { ref: outerGroupRef, controllerProps: controllerProps, children: [_jsxs(VehicleRigidBody, { ref: rigidBodyRef, controllerProps: controllerProps, children: [_jsx(VehicleCollider, {}), controllerProps.isRider && (_jsx(CharacterInnerGroupRef, { prop: controllerProps, groupProps: controllerProps.groupProps, groundRay: controllerProps.groundRay, refs: refs, callbacks: controllerProps.callbacks, ref: characterInnerRef, isRider: true })), _jsx(VehicleInnerGroupRef, { ref: innerGroupRef })] }), _jsx(Wheels, { prop: controllerProps })] }));
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { forwardRef, useContext } from "react";
3
3
  import { GaesupWorldContext } from "../../world/context";
4
- export const AirplaneInnerGroupRef = forwardRef((_, ref) => {
5
- const { airplaneGltf: gltf } = useContext(GaesupWorldContext);
6
- const { materials, nodes } = gltf;
7
- return (_jsx(_Fragment, { children: nodes && materials && (_jsx("group", { receiveShadow: true, castShadow: true, ref: ref, children: Object.keys(nodes).map((name, key) => {
4
+ export var AirplaneInnerGroupRef = forwardRef(function (_, ref) {
5
+ var gltf = useContext(GaesupWorldContext).airplaneGltf;
6
+ var materials = gltf.materials, nodes = gltf.nodes;
7
+ return (_jsx(_Fragment, { children: nodes && materials && (_jsx("group", { receiveShadow: true, castShadow: true, ref: ref, children: Object.keys(nodes).map(function (name, key) {
8
8
  if (nodes[name].type === "Mesh" ||
9
9
  nodes[name].type === "SkinnedMesh") {
10
10
  return (_jsx("mesh", { castShadow: true, receiveShadow: true, material: materials[name], geometry: nodes[name].geometry }, key));
@@ -1,32 +1,44 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
1
12
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
13
  import { forwardRef, useContext } from "react";
3
14
  import playActions from "../../animation/actions";
4
15
  import initCallback from "../../initial/callback";
5
16
  import { GaesupWorldContext } from "../../world/context";
6
- export const InnerGroupRef = forwardRef((_, ref) => {
17
+ export var InnerGroupRef = forwardRef(function (_, ref) {
7
18
  return _jsx("group", { ref: ref, visible: false });
8
19
  });
9
- export const CharacterInnerGroupRef = forwardRef(({ prop, groupProps, groundRay, refs, callbacks, isRider, }, ref) => {
10
- const { characterGltf: gltf } = useContext(GaesupWorldContext);
11
- const { materials, nodes } = gltf;
12
- const { characterCollider, vehicleCollider } = useContext(GaesupWorldContext);
20
+ export var CharacterInnerGroupRef = forwardRef(function (_a, ref) {
21
+ var prop = _a.prop, groupProps = _a.groupProps, groundRay = _a.groundRay, refs = _a.refs, callbacks = _a.callbacks, isRider = _a.isRider;
22
+ var gltf = useContext(GaesupWorldContext).characterGltf;
23
+ var materials = gltf.materials, nodes = gltf.nodes;
24
+ var _b = useContext(GaesupWorldContext), characterCollider = _b.characterCollider, vehicleCollider = _b.vehicleCollider;
13
25
  initCallback({
14
- prop,
15
- callbacks,
26
+ prop: prop,
27
+ callbacks: callbacks,
16
28
  outerGroupRef: refs.outerGroupRef,
17
29
  });
18
30
  playActions({
19
31
  outerGroupRef: refs.outerGroupRef,
20
32
  groundRay: groundRay,
21
- isRider,
33
+ isRider: isRider,
22
34
  });
23
- return (_jsx(_Fragment, { children: nodes && materials && (_jsxs("group", Object.assign({ receiveShadow: true, castShadow: true }, groupProps, { position: [
35
+ return (_jsx(_Fragment, { children: nodes && materials && (_jsxs("group", __assign({ receiveShadow: true, castShadow: true }, groupProps, { position: [
24
36
  0,
25
37
  isRider
26
38
  ? vehicleCollider.vehicleSizeY / 2
27
39
  : -characterCollider.height,
28
40
  0,
29
- ], ref: ref, children: [Object.values(nodes).find((node) => node.type === "Object3D") && (_jsx("primitive", { object: Object.values(nodes).find((node) => node.type === "Object3D"), visible: false, receiveShadow: true, castShadow: true })), Object.keys(nodes).map((name, key) => {
41
+ ], ref: ref, children: [Object.values(nodes).find(function (node) { return node.type === "Object3D"; }) && (_jsx("primitive", { object: Object.values(nodes).find(function (node) { return node.type === "Object3D"; }), visible: false, receiveShadow: true, castShadow: true })), Object.keys(nodes).map(function (name, key) {
30
42
  if (nodes[name].type === "SkinnedMesh") {
31
43
  return (_jsx("skinnedMesh", { castShadow: true, receiveShadow: true, material: materials[name], geometry: nodes[name].geometry, skeleton: nodes[name].skeleton }, key));
32
44
  }
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { forwardRef, useContext } from "react";
3
3
  import { GaesupWorldContext } from "../../world/context";
4
- export const VehicleInnerGroupRef = forwardRef((_, ref) => {
5
- const { vehicleGltf: gltf } = useContext(GaesupWorldContext);
6
- const { materials, nodes } = gltf;
7
- return (_jsx(_Fragment, { children: nodes && materials && (_jsx("group", { receiveShadow: true, castShadow: true, rotation: [0, Math.PI, 0], ref: ref, children: Object.keys(nodes).map((name, key) => {
4
+ export var VehicleInnerGroupRef = forwardRef(function (_, ref) {
5
+ var gltf = useContext(GaesupWorldContext).vehicleGltf;
6
+ var materials = gltf.materials, nodes = gltf.nodes;
7
+ return (_jsx(_Fragment, { children: nodes && materials && (_jsx("group", { receiveShadow: true, castShadow: true, rotation: [0, Math.PI, 0], ref: ref, children: Object.keys(nodes).map(function (name, key) {
8
8
  if (nodes[name].type === "Mesh" ||
9
9
  nodes[name].type === "SkinnedMesh") {
10
10
  return (_jsx("mesh", { castShadow: true, receiveShadow: true, material: materials[name], geometry: nodes[name].geometry }, key));
@@ -2,19 +2,20 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { createRef, useContext, useRef } from "react";
3
3
  import { GaesupWorldContext } from "../../world/context";
4
4
  import { WheelRegidBodyRef } from "../ref/vehicle";
5
- export function Wheels({ prop }) {
6
- const { rigidBodyRef, constant } = prop;
7
- const { wheelOffset } = constant;
8
- const { vehicleCollider: collider } = useContext(GaesupWorldContext);
9
- const { vehicleSizeX, vehicleSizeZ, wheelSizeX, wheelSizeZ } = collider;
10
- const X = (vehicleSizeX + wheelSizeX) / 2 + wheelOffset;
11
- const Z = (vehicleSizeZ + wheelSizeZ) / 2 + wheelOffset;
12
- const wheelPositions = [
5
+ export function Wheels(_a) {
6
+ var prop = _a.prop;
7
+ var rigidBodyRef = prop.rigidBodyRef, constant = prop.constant;
8
+ var wheelOffset = constant.wheelOffset;
9
+ var collider = useContext(GaesupWorldContext).vehicleCollider;
10
+ var vehicleSizeX = collider.vehicleSizeX, vehicleSizeZ = collider.vehicleSizeZ, wheelSizeX = collider.wheelSizeX, wheelSizeZ = collider.wheelSizeZ;
11
+ var X = (vehicleSizeX + wheelSizeX) / 2 + wheelOffset;
12
+ var Z = (vehicleSizeZ + wheelSizeZ) / 2 + wheelOffset;
13
+ var wheelPositions = [
13
14
  [-X, 0, Z],
14
15
  [-X, 0, -Z],
15
16
  [X, 0, Z],
16
17
  [X, 0, -Z],
17
18
  ];
18
- const wheelRefs = useRef(wheelPositions.map(() => createRef()));
19
- return (_jsx(_Fragment, { children: wheelPositions.map((wheelPosition, index) => (_jsx(WheelRegidBodyRef, { ref: wheelRefs.current[index], wheelPosition: wheelPosition, bodyRef: rigidBodyRef, wheel: wheelRefs.current[index], bodyAnchor: wheelPosition, wheelAnchor: [0, 0, 0], rotationAxis: [1, 0, 0] }, index))) }));
19
+ var wheelRefs = useRef(wheelPositions.map(function () { return createRef(); }));
20
+ return (_jsx(_Fragment, { children: wheelPositions.map(function (wheelPosition, index) { return (_jsx(WheelRegidBodyRef, { ref: wheelRefs.current[index], wheelPosition: wheelPosition, bodyRef: rigidBodyRef, wheel: wheelRefs.current[index], bodyAnchor: wheelPosition, wheelAnchor: [0, 0, 0], rotationAxis: [1, 0, 0] }, index)); }) }));
20
21
  }
@@ -1,32 +1,46 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
1
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
13
  import { CuboidCollider, RigidBody, useRapier, } from "@react-three/rapier";
3
14
  import { forwardRef, useContext } from "react";
4
15
  import { getRayHit } from "../../utils/ray";
5
16
  import { useForwardRef } from "../../utils/ref";
6
17
  import { GaesupWorldContext } from "../../world/context";
7
- export const AirplaneRigidBody = forwardRef(({ controllerProps, children, }, ref) => {
8
- return (_jsxs(RigidBody, Object.assign({ colliders: false, ref: ref }, controllerProps.rigidBodyProps, { children: [controllerProps.debug && (_jsx("mesh", { visible: controllerProps.debug, children: _jsx("arrowHelper", { args: [
18
+ export var AirplaneRigidBody = forwardRef(function (_a, ref) {
19
+ var controllerProps = _a.controllerProps, children = _a.children;
20
+ return (_jsxs(RigidBody, __assign({ colliders: false, ref: ref }, controllerProps.rigidBodyProps, { children: [controllerProps.debug && (_jsx("mesh", { visible: controllerProps.debug, children: _jsx("arrowHelper", { args: [
9
21
  controllerProps.groundRay.dir,
10
22
  controllerProps.groundRay.origin,
11
23
  controllerProps.groundRay.length,
12
24
  ] }) })), children] })));
13
25
  });
14
- export const AirplaneCollider = forwardRef(({ prop }, ref) => {
15
- var _a;
16
- const { airplaneCollider: collider } = useContext(GaesupWorldContext);
17
- const { airplaneSizeX, airplaneSizeY, airplaneSizeZ } = collider;
18
- const colliderRef = useForwardRef(ref);
19
- const { rapier } = useRapier();
20
- const { groundRay } = prop;
26
+ export var AirplaneCollider = forwardRef(function (_a, ref) {
27
+ var _b;
28
+ var prop = _a.prop;
29
+ var collider = useContext(GaesupWorldContext).airplaneCollider;
30
+ var airplaneSizeX = collider.airplaneSizeX, airplaneSizeY = collider.airplaneSizeY, airplaneSizeZ = collider.airplaneSizeZ;
31
+ var colliderRef = useForwardRef(ref);
32
+ var rapier = useRapier().rapier;
33
+ var groundRay = prop.groundRay;
21
34
  groundRay.length = airplaneSizeY * 5 + 2;
22
35
  groundRay.rayCast = new rapier.Ray(groundRay.origin, groundRay.dir);
23
36
  groundRay.hit = getRayHit({
24
37
  ray: groundRay,
25
38
  ref: colliderRef,
26
39
  });
27
- groundRay.parent = (_a = groundRay.hit) === null || _a === void 0 ? void 0 : _a.collider.parent();
40
+ groundRay.parent = (_b = groundRay.hit) === null || _b === void 0 ? void 0 : _b.collider.parent();
28
41
  return (_jsx(CuboidCollider, { ref: ref, args: [airplaneSizeX / 2, airplaneSizeY / 2, airplaneSizeZ / 2], position: [0, airplaneSizeY / 2, 0] }));
29
42
  });
30
- export const AirplaneGroup = forwardRef(({ controllerProps, children, }, ref) => {
31
- return (_jsx("group", Object.assign({ ref: ref, userData: { intangible: true } }, controllerProps.airplane, { children: children })));
43
+ export var AirplaneGroup = forwardRef(function (_a, ref) {
44
+ var controllerProps = _a.controllerProps, children = _a.children;
45
+ return (_jsx("group", __assign({ ref: ref, userData: { intangible: true } }, controllerProps.airplane, { children: children })));
32
46
  });
@@ -1,38 +1,53 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
1
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
13
  import { CapsuleCollider, RigidBody, useRapier, } from "@react-three/rapier";
3
14
  import { forwardRef, useContext } from "react";
4
15
  import { getRayHit } from "../../utils/ray";
5
16
  import { useForwardRef } from "../../utils/ref";
6
17
  import { GaesupWorldContext } from "../../world/context";
7
- export const CharacterRigidBody = forwardRef(({ controllerProps, children, }, ref) => {
8
- return (_jsxs(RigidBody, Object.assign({ colliders: false, canSleep: false, ref: ref }, controllerProps.rigidBodyProps, { children: [controllerProps.debug && (_jsx("mesh", { visible: controllerProps.debug, children: _jsx("arrowHelper", { args: [
18
+ export var CharacterRigidBody = forwardRef(function (_a, ref) {
19
+ var controllerProps = _a.controllerProps, children = _a.children;
20
+ return (_jsxs(RigidBody, __assign({ colliders: false, canSleep: false, ref: ref }, controllerProps.rigidBodyProps, { children: [controllerProps.debug && (_jsx("mesh", { visible: controllerProps.debug, children: _jsx("arrowHelper", { args: [
9
21
  controllerProps.groundRay.dir,
10
22
  controllerProps.groundRay.origin,
11
23
  controllerProps.groundRay.length,
12
24
  ] }) })), children] })));
13
25
  });
14
- export const CharacterCapsuleCollider = forwardRef(({ prop }, ref) => {
15
- var _a;
16
- const { characterCollider: collider } = useContext(GaesupWorldContext);
17
- const colliderRef = useForwardRef(ref);
18
- const { rapier } = useRapier();
19
- const { groundRay, slopeRay } = prop;
26
+ export var CharacterCapsuleCollider = forwardRef(function (_a, ref) {
27
+ var _b;
28
+ var prop = _a.prop;
29
+ var collider = useContext(GaesupWorldContext).characterCollider;
30
+ var colliderRef = useForwardRef(ref);
31
+ var rapier = useRapier().rapier;
32
+ var groundRay = prop.groundRay, slopeRay = prop.slopeRay;
20
33
  groundRay.length = collider.radius + 2;
21
34
  groundRay.rayCast = new rapier.Ray(groundRay.origin, groundRay.dir);
22
35
  groundRay.hit = getRayHit({
23
36
  ray: groundRay,
24
37
  ref: colliderRef,
25
38
  });
26
- groundRay.parent = (_a = groundRay.hit) === null || _a === void 0 ? void 0 : _a.collider.parent();
39
+ groundRay.parent = (_b = groundRay.hit) === null || _b === void 0 ? void 0 : _b.collider.parent();
27
40
  slopeRay.rayCast = new rapier.Ray(slopeRay.origin, slopeRay.dir);
28
41
  slopeRay.length = collider.radius + 3;
29
42
  slopeRay.rayCast = new rapier.Ray(slopeRay.origin, slopeRay.dir);
30
43
  return (_jsx(CapsuleCollider, { ref: ref, args: [collider.height, collider.radius] }));
31
44
  });
32
- export const CharacterGroup = forwardRef(({ controllerProps, children, }, ref) => {
33
- return (_jsx("group", Object.assign({ ref: ref, userData: { intangible: true } }, controllerProps.character, { children: children })));
45
+ export var CharacterGroup = forwardRef(function (_a, ref) {
46
+ var controllerProps = _a.controllerProps, children = _a.children;
47
+ return (_jsx("group", __assign({ ref: ref, userData: { intangible: true } }, controllerProps.character, { children: children })));
34
48
  });
35
- export const CharacterSlopeRay = forwardRef(({ groundRay, slopeRay, }, ref) => {
49
+ export var CharacterSlopeRay = forwardRef(function (_a, ref) {
50
+ var groundRay = _a.groundRay, slopeRay = _a.slopeRay;
36
51
  return (_jsx("mesh", { position: [
37
52
  groundRay.offset.x,
38
53
  groundRay.offset.y,
@@ -1,27 +1,41 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
1
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
13
  import { Gltf } from "@react-three/drei";
3
14
  import { CuboidCollider, CylinderCollider, RigidBody, useRevoluteJoint, } from "@react-three/rapier";
4
15
  import { forwardRef, useContext } from "react";
5
16
  import { S3 } from "../../utils/constant";
6
17
  import { GaesupWorldContext } from "../../world/context";
7
- export const VehicleRigidBody = forwardRef(({ controllerProps, children, }, ref) => {
8
- return (_jsxs(RigidBody, Object.assign({ colliders: false, ref: ref }, controllerProps.rigidBodyProps, { children: [controllerProps.debug && (_jsx("mesh", { visible: controllerProps.debug, children: _jsx("arrowHelper", { args: [
18
+ export var VehicleRigidBody = forwardRef(function (_a, ref) {
19
+ var controllerProps = _a.controllerProps, children = _a.children;
20
+ return (_jsxs(RigidBody, __assign({ colliders: false, ref: ref }, controllerProps.rigidBodyProps, { children: [controllerProps.debug && (_jsx("mesh", { visible: controllerProps.debug, children: _jsx("arrowHelper", { args: [
9
21
  controllerProps.groundRay.dir,
10
22
  controllerProps.groundRay.origin,
11
23
  controllerProps.groundRay.length,
12
24
  ] }) })), children] })));
13
25
  });
14
- export const VehicleCollider = forwardRef((_, ref) => {
15
- const { vehicleCollider: collider } = useContext(GaesupWorldContext);
16
- const { vehicleSizeX, vehicleSizeY, vehicleSizeZ } = collider;
26
+ export var VehicleCollider = forwardRef(function (_, ref) {
27
+ var collider = useContext(GaesupWorldContext).vehicleCollider;
28
+ var vehicleSizeX = collider.vehicleSizeX, vehicleSizeY = collider.vehicleSizeY, vehicleSizeZ = collider.vehicleSizeZ;
17
29
  return (_jsx(CuboidCollider, { ref: ref, args: [vehicleSizeX / 2, vehicleSizeY / 2, vehicleSizeZ / 2], position: [0, vehicleSizeY / 2, 0] }));
18
30
  });
19
- export const VehicleGroup = forwardRef(({ controllerProps, children, }, ref) => {
20
- return (_jsx("group", Object.assign({ ref: ref, userData: { intangible: true } }, controllerProps.vehicle, { children: children })));
31
+ export var VehicleGroup = forwardRef(function (_a, ref) {
32
+ var controllerProps = _a.controllerProps, children = _a.children;
33
+ return (_jsx("group", __assign({ ref: ref, userData: { intangible: true } }, controllerProps.vehicle, { children: children })));
21
34
  });
22
- export const WheelRegidBodyRef = forwardRef(({ wheelPosition, wheelsUrl, bodyRef, wheel, bodyAnchor, wheelAnchor, rotationAxis, }, ref) => {
23
- const { vehicleCollider: collider } = useContext(GaesupWorldContext);
24
- const { wheelSizeX, wheelSizeY } = collider;
35
+ export var WheelRegidBodyRef = forwardRef(function (_a, ref) {
36
+ var wheelPosition = _a.wheelPosition, wheelsUrl = _a.wheelsUrl, bodyRef = _a.bodyRef, wheel = _a.wheel, bodyAnchor = _a.bodyAnchor, wheelAnchor = _a.wheelAnchor, rotationAxis = _a.rotationAxis;
37
+ var collider = useContext(GaesupWorldContext).vehicleCollider;
38
+ var wheelSizeX = collider.wheelSizeX, wheelSizeY = collider.wheelSizeY;
25
39
  useRevoluteJoint(bodyRef, wheel, [bodyAnchor, wheelAnchor, rotationAxis]);
26
40
  return (_jsxs(RigidBody, { position: wheelPosition, colliders: false, ref: ref, children: [_jsx(CylinderCollider, { args: [wheelSizeX / 2, wheelSizeY / 2], rotation: [0, 0, Math.PI / 2] }), _jsx(Gltf, { src: wheelsUrl || S3 + "/wheel.glb" })] }));
27
41
  });
@@ -2,8 +2,8 @@ import { useContext, useEffect } from "react";
2
2
  import { V3 } from "../utils/vector";
3
3
  import { GaesupWorldContext } from "../world/context";
4
4
  export default function setInit(rigidBodyRef) {
5
- const { activeState } = useContext(GaesupWorldContext);
6
- useEffect(() => {
5
+ var activeState = useContext(GaesupWorldContext).activeState;
6
+ useEffect(function () {
7
7
  var _a;
8
8
  (_a = rigidBodyRef.current) === null || _a === void 0 ? void 0 : _a.setTranslation(activeState.position.add(V3(0, 1, 0)), false);
9
9
  }, []);