gaesup-world 0.2.21 → 0.2.23

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 (216) hide show
  1. package/package.json +5 -2
  2. package/dist/gaesup/animation/actions.d.ts +0 -44
  3. package/dist/gaesup/animation/actions.js +0 -103
  4. package/dist/gaesup/camera/control/normal.d.ts +0 -4
  5. package/dist/gaesup/camera/control/normal.js +0 -18
  6. package/dist/gaesup/camera/control/orbit.d.ts +0 -4
  7. package/dist/gaesup/camera/control/orbit.js +0 -22
  8. package/dist/gaesup/camera/detector/index.d.ts +0 -2
  9. package/dist/gaesup/camera/detector/index.js +0 -25
  10. package/dist/gaesup/camera/index.d.ts +0 -8
  11. package/dist/gaesup/camera/index.js +0 -139
  12. package/dist/gaesup/camera/type.d.ts +0 -13
  13. package/dist/gaesup/camera/type.js +0 -1
  14. package/dist/gaesup/component/active/airplane/index.d.ts +0 -11
  15. package/dist/gaesup/component/active/airplane/index.js +0 -6
  16. package/dist/gaesup/component/active/character/index.d.ts +0 -7
  17. package/dist/gaesup/component/active/character/index.js +0 -34
  18. package/dist/gaesup/component/active/vehicle/index.d.ts +0 -12
  19. package/dist/gaesup/component/active/vehicle/index.js +0 -31
  20. package/dist/gaesup/component/index.d.ts +0 -7
  21. package/dist/gaesup/component/index.js +0 -19
  22. package/dist/gaesup/component/inner/airplane/index.d.ts +0 -2
  23. package/dist/gaesup/component/inner/airplane/index.js +0 -16
  24. package/dist/gaesup/component/inner/character/index.d.ts +0 -25
  25. package/dist/gaesup/component/inner/character/index.js +0 -28
  26. package/dist/gaesup/component/inner/common/InnerGroupRef.d.ts +0 -10
  27. package/dist/gaesup/component/inner/common/InnerGroupRef.js +0 -29
  28. package/dist/gaesup/component/inner/common/OuterGroupRef.d.ts +0 -4
  29. package/dist/gaesup/component/inner/common/OuterGroupRef.js +0 -6
  30. package/dist/gaesup/component/inner/common/RigidbodyRef.d.ts +0 -12
  31. package/dist/gaesup/component/inner/common/RigidbodyRef.js +0 -7
  32. package/dist/gaesup/component/inner/common/setGroundRay.d.ts +0 -9
  33. package/dist/gaesup/component/inner/common/setGroundRay.js +0 -14
  34. package/dist/gaesup/component/inner/common/type.d.ts +0 -20
  35. package/dist/gaesup/component/inner/common/type.js +0 -1
  36. package/dist/gaesup/component/inner/rider/index.d.ts +0 -11
  37. package/dist/gaesup/component/inner/rider/index.js +0 -31
  38. package/dist/gaesup/component/inner/vehicle/collider.d.ts +0 -10
  39. package/dist/gaesup/component/inner/vehicle/collider.js +0 -19
  40. package/dist/gaesup/component/inner/vehicle/index.d.ts +0 -2
  41. package/dist/gaesup/component/inner/vehicle/index.js +0 -17
  42. package/dist/gaesup/component/inner/vehicle/wheels.d.ts +0 -7
  43. package/dist/gaesup/component/inner/vehicle/wheels.js +0 -64
  44. package/dist/gaesup/component/passive/airplane/index.d.ts +0 -13
  45. package/dist/gaesup/component/passive/airplane/index.js +0 -40
  46. package/dist/gaesup/component/passive/character/index.d.ts +0 -10
  47. package/dist/gaesup/component/passive/character/index.js +0 -46
  48. package/dist/gaesup/component/passive/type.d.ts +0 -20
  49. package/dist/gaesup/component/passive/type.js +0 -1
  50. package/dist/gaesup/component/passive/vehicle/index.d.ts +0 -13
  51. package/dist/gaesup/component/passive/vehicle/index.js +0 -17
  52. package/dist/gaesup/component/type.d.ts +0 -17
  53. package/dist/gaesup/component/type.js +0 -1
  54. package/dist/gaesup/controller/context/index.d.ts +0 -49
  55. package/dist/gaesup/controller/context/index.js +0 -59
  56. package/dist/gaesup/controller/context/reducer.d.ts +0 -12
  57. package/dist/gaesup/controller/context/reducer.js +0 -21
  58. package/dist/gaesup/controller/context/type.d.ts +0 -38
  59. package/dist/gaesup/controller/context/type.js +0 -1
  60. package/dist/gaesup/controller/debug/airplane.d.ts +0 -71
  61. package/dist/gaesup/controller/debug/airplane.js +0 -71
  62. package/dist/gaesup/controller/debug/character.d.ts +0 -27
  63. package/dist/gaesup/controller/debug/character.js +0 -27
  64. package/dist/gaesup/controller/debug/index.d.ts +0 -6
  65. package/dist/gaesup/controller/debug/index.js +0 -49
  66. package/dist/gaesup/controller/debug/vehicle.d.ts +0 -27
  67. package/dist/gaesup/controller/debug/vehicle.js +0 -27
  68. package/dist/gaesup/controller/index.d.ts +0 -3
  69. package/dist/gaesup/controller/index.js +0 -74
  70. package/dist/gaesup/controller/initialize/callback/index.d.ts +0 -2
  71. package/dist/gaesup/controller/initialize/callback/index.js +0 -62
  72. package/dist/gaesup/controller/initialize/callback/type.d.ts +0 -27
  73. package/dist/gaesup/controller/initialize/callback/type.js +0 -1
  74. package/dist/gaesup/controller/initialize/index.d.ts +0 -10
  75. package/dist/gaesup/controller/initialize/index.js +0 -75
  76. package/dist/gaesup/controller/type.d.ts +0 -85
  77. package/dist/gaesup/controller/type.js +0 -1
  78. package/dist/gaesup/gaesupProps/index.d.ts +0 -7
  79. package/dist/gaesup/gaesupProps/index.js +0 -46
  80. package/dist/gaesup/hooks/useGaesupAnimation/index.d.ts +0 -10
  81. package/dist/gaesup/hooks/useGaesupAnimation/index.js +0 -95
  82. package/dist/gaesup/hooks/useGaesupController/index.d.ts +0 -10
  83. package/dist/gaesup/hooks/useGaesupController/index.js +0 -14
  84. package/dist/gaesup/hooks/useGaesupGltf/index.d.ts +0 -25
  85. package/dist/gaesup/hooks/useGaesupGltf/index.js +0 -73
  86. package/dist/gaesup/hooks/useJoyStick/index.d.ts +0 -39
  87. package/dist/gaesup/hooks/useJoyStick/index.js +0 -61
  88. package/dist/gaesup/hooks/usePushKey/index.d.ts +0 -3
  89. package/dist/gaesup/hooks/usePushKey/index.js +0 -29
  90. package/dist/gaesup/hooks/useRideable/index.d.ts +0 -28
  91. package/dist/gaesup/hooks/useRideable/index.js +0 -199
  92. package/dist/gaesup/hooks/useTeleport/index.d.ts +0 -3
  93. package/dist/gaesup/hooks/useTeleport/index.js +0 -12
  94. package/dist/gaesup/physics/airplane/damping.d.ts +0 -2
  95. package/dist/gaesup/physics/airplane/damping.js +0 -5
  96. package/dist/gaesup/physics/airplane/direction.d.ts +0 -2
  97. package/dist/gaesup/physics/airplane/direction.js +0 -65
  98. package/dist/gaesup/physics/airplane/gravity.d.ts +0 -14
  99. package/dist/gaesup/physics/airplane/gravity.js +0 -18
  100. package/dist/gaesup/physics/airplane/impulse.d.ts +0 -16
  101. package/dist/gaesup/physics/airplane/impulse.js +0 -31
  102. package/dist/gaesup/physics/airplane/index.d.ts +0 -2
  103. package/dist/gaesup/physics/airplane/index.js +0 -14
  104. package/dist/gaesup/physics/airplane/innerCalc.d.ts +0 -2
  105. package/dist/gaesup/physics/airplane/innerCalc.js +0 -27
  106. package/dist/gaesup/physics/airplane/landing.d.ts +0 -2
  107. package/dist/gaesup/physics/airplane/landing.js +0 -29
  108. package/dist/gaesup/physics/character/direction.d.ts +0 -23
  109. package/dist/gaesup/physics/character/direction.js +0 -55
  110. package/dist/gaesup/physics/character/impulse.d.ts +0 -2
  111. package/dist/gaesup/physics/character/impulse.js +0 -43
  112. package/dist/gaesup/physics/character/index.d.ts +0 -2
  113. package/dist/gaesup/physics/character/index.js +0 -8
  114. package/dist/gaesup/physics/character/innerCalc.d.ts +0 -2
  115. package/dist/gaesup/physics/character/innerCalc.js +0 -31
  116. package/dist/gaesup/physics/check/ground.d.ts +0 -2
  117. package/dist/gaesup/physics/check/ground.js +0 -15
  118. package/dist/gaesup/physics/check/index.d.ts +0 -2
  119. package/dist/gaesup/physics/check/index.js +0 -12
  120. package/dist/gaesup/physics/check/moving.d.ts +0 -2
  121. package/dist/gaesup/physics/check/moving.js +0 -16
  122. package/dist/gaesup/physics/check/push.d.ts +0 -2
  123. package/dist/gaesup/physics/check/push.js +0 -6
  124. package/dist/gaesup/physics/check/riding.d.ts +0 -2
  125. package/dist/gaesup/physics/check/riding.js +0 -7
  126. package/dist/gaesup/physics/check/rotate.d.ts +0 -2
  127. package/dist/gaesup/physics/check/rotate.js +0 -8
  128. package/dist/gaesup/physics/index.d.ts +0 -2
  129. package/dist/gaesup/physics/index.js +0 -58
  130. package/dist/gaesup/physics/type.d.ts +0 -36
  131. package/dist/gaesup/physics/type.js +0 -1
  132. package/dist/gaesup/physics/vehicle/damping.d.ts +0 -2
  133. package/dist/gaesup/physics/vehicle/damping.js +0 -6
  134. package/dist/gaesup/physics/vehicle/direction.d.ts +0 -4
  135. package/dist/gaesup/physics/vehicle/direction.js +0 -30
  136. package/dist/gaesup/physics/vehicle/impulse.d.ts +0 -16
  137. package/dist/gaesup/physics/vehicle/impulse.js +0 -40
  138. package/dist/gaesup/physics/vehicle/index.d.ts +0 -2
  139. package/dist/gaesup/physics/vehicle/index.js +0 -12
  140. package/dist/gaesup/physics/vehicle/innerCalc.d.ts +0 -2
  141. package/dist/gaesup/physics/vehicle/innerCalc.js +0 -24
  142. package/dist/gaesup/physics/vehicle/landing.d.ts +0 -2
  143. package/dist/gaesup/physics/vehicle/landing.js +0 -29
  144. package/dist/gaesup/tools/gameBoy/GameBoyButton.d.ts +0 -9
  145. package/dist/gaesup/tools/gameBoy/GameBoyButton.js +0 -16
  146. package/dist/gaesup/tools/gameBoy/index.d.ts +0 -8
  147. package/dist/gaesup/tools/gameBoy/index.js +0 -22
  148. package/dist/gaesup/tools/gameBoy/type.d.ts +0 -4
  149. package/dist/gaesup/tools/gameBoy/type.js +0 -1
  150. package/dist/gaesup/tools/gamePad/GamePadButton.d.ts +0 -8
  151. package/dist/gaesup/tools/gamePad/GamePadButton.js +0 -21
  152. package/dist/gaesup/tools/gamePad/index.d.ts +0 -6
  153. package/dist/gaesup/tools/gamePad/index.js +0 -32
  154. package/dist/gaesup/tools/gamePad/type.d.ts +0 -6
  155. package/dist/gaesup/tools/gamePad/type.js +0 -1
  156. package/dist/gaesup/tools/joyStick/index.d.ts +0 -6
  157. package/dist/gaesup/tools/joyStick/index.js +0 -169
  158. package/dist/gaesup/tools/joyStick/type.d.ts +0 -19
  159. package/dist/gaesup/tools/joyStick/type.js +0 -1
  160. package/dist/gaesup/tools/jumpPortal/index.d.ts +0 -16
  161. package/dist/gaesup/tools/jumpPortal/index.js +0 -18
  162. package/dist/gaesup/tools/keyBoardToolTip/constant.d.ts +0 -402
  163. package/dist/gaesup/tools/keyBoardToolTip/constant.js +0 -122
  164. package/dist/gaesup/tools/keyBoardToolTip/default.d.ts +0 -10
  165. package/dist/gaesup/tools/keyBoardToolTip/default.js +0 -12
  166. package/dist/gaesup/tools/keyBoardToolTip/index.d.ts +0 -3
  167. package/dist/gaesup/tools/keyBoardToolTip/index.js +0 -70
  168. package/dist/gaesup/tools/keyBoardToolTip/type.d.ts +0 -37
  169. package/dist/gaesup/tools/keyBoardToolTip/type.js +0 -1
  170. package/dist/gaesup/tools/miniMap/default.d.ts +0 -9
  171. package/dist/gaesup/tools/miniMap/default.js +0 -9
  172. package/dist/gaesup/tools/miniMap/index.d.ts +0 -3
  173. package/dist/gaesup/tools/miniMap/index.js +0 -72
  174. package/dist/gaesup/tools/miniMap/type.d.ts +0 -25
  175. package/dist/gaesup/tools/miniMap/type.js +0 -1
  176. package/dist/gaesup/tools/rideable/index.d.ts +0 -3
  177. package/dist/gaesup/tools/rideable/index.js +0 -79
  178. package/dist/gaesup/tools/type.d.ts +0 -2
  179. package/dist/gaesup/tools/type.js +0 -1
  180. package/dist/gaesup/tools/zoomButton/index.d.ts +0 -18
  181. package/dist/gaesup/tools/zoomButton/index.js +0 -146
  182. package/dist/gaesup/utils/context.d.ts +0 -2
  183. package/dist/gaesup/utils/context.js +0 -3
  184. package/dist/gaesup/utils/debug.d.ts +0 -29
  185. package/dist/gaesup/utils/debug.js +0 -36
  186. package/dist/gaesup/utils/index.d.ts +0 -3
  187. package/dist/gaesup/utils/index.js +0 -3
  188. package/dist/gaesup/utils/ray.d.ts +0 -7
  189. package/dist/gaesup/utils/ray.js +0 -6
  190. package/dist/gaesup/utils/ref.d.ts +0 -2
  191. package/dist/gaesup/utils/ref.js +0 -16
  192. package/dist/gaesup/utils/type.d.ts +0 -5
  193. package/dist/gaesup/utils/type.js +0 -1
  194. package/dist/gaesup/utils/vector.d.ts +0 -10
  195. package/dist/gaesup/utils/vector.js +0 -33
  196. package/dist/gaesup/world/context/index.d.ts +0 -6
  197. package/dist/gaesup/world/context/index.js +0 -117
  198. package/dist/gaesup/world/context/reducer.d.ts +0 -29
  199. package/dist/gaesup/world/context/reducer.js +0 -21
  200. package/dist/gaesup/world/context/type.d.ts +0 -169
  201. package/dist/gaesup/world/context/type.js +0 -1
  202. package/dist/gaesup/world/debug/cameraOption.d.ts +0 -47
  203. package/dist/gaesup/world/debug/cameraOption.js +0 -47
  204. package/dist/gaesup/world/debug/index.d.ts +0 -6
  205. package/dist/gaesup/world/debug/index.js +0 -32
  206. package/dist/gaesup/world/debug/mode.d.ts +0 -10
  207. package/dist/gaesup/world/debug/mode.js +0 -10
  208. package/dist/gaesup/world/index.d.ts +0 -3
  209. package/dist/gaesup/world/index.js +0 -9
  210. package/dist/gaesup/world/initalize/index.d.ts +0 -35
  211. package/dist/gaesup/world/initalize/index.js +0 -62
  212. package/dist/gaesup/world/type.d.ts +0 -19
  213. package/dist/gaesup/world/type.js +0 -1
  214. package/dist/index.d.ts +0 -23
  215. package/index.ts +0 -29
  216. package/yarn-error.log +0 -12152
@@ -1,199 +0,0 @@
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
- };
12
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
- return new (P || (P = Promise))(function (resolve, reject) {
15
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
- step((generator = generator.apply(thisArg, _arguments || [])).next());
19
- });
20
- };
21
- var __generator = (this && this.__generator) || function (thisArg, body) {
22
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
- function verb(n) { return function (v) { return step([n, v]); }; }
25
- function step(op) {
26
- if (f) throw new TypeError("Generator is already executing.");
27
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
- if (y = 0, t) op = [op[0] & 2, t.value];
30
- switch (op[0]) {
31
- case 0: case 1: t = op; break;
32
- case 4: _.label++; return { value: op[1], done: false };
33
- case 5: _.label++; y = op[1]; op = [0]; continue;
34
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
- default:
36
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
- if (t[2]) _.ops.pop();
41
- _.trys.pop(); continue;
42
- }
43
- op = body.call(thisArg, _);
44
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
- }
47
- };
48
- import { euler, vec3 } from "@react-three/rapier";
49
- import { useContext } from "react";
50
- import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../../world/context";
51
- import { useGaesupGltf } from "../useGaesupGltf";
52
- /**
53
- * Default rideable object properties.
54
- * @type {Object}
55
- */
56
- export var rideableDefault = {
57
- objectkey: null,
58
- objectType: null,
59
- isRiderOn: false,
60
- url: null,
61
- wheelUrl: null,
62
- position: vec3(),
63
- rotation: euler(),
64
- offset: vec3(),
65
- visible: true,
66
- };
67
- /**
68
- * Custom hook for managing rideable objects.
69
- * @returns {Object} An object containing functions to initialize, set, get, ride, and land rideable objects.
70
- */
71
- export function useRideable() {
72
- var _this = this;
73
- var worldContext = useContext(GaesupWorldContext);
74
- var urls = worldContext.urls, states = worldContext.states, rideable = worldContext.rideable, mode = worldContext.mode;
75
- var dispatch = useContext(GaesupWorldDispatchContext);
76
- var getSizesByUrls = useGaesupGltf().getSizesByUrls;
77
- /**
78
- * Initialize a rideable object with the provided properties.
79
- * @param {rideableType} props - The properties of the rideable object to initialize.
80
- */
81
- var initRideable = function (props) {
82
- rideable[props.objectkey] = __assign(__assign({}, rideableDefault), props);
83
- };
84
- /**
85
- * Set the properties of a rideable object.
86
- * @param {rideableType} props - The properties to set for the rideable object.
87
- */
88
- var setRideable = function (props) {
89
- rideable[props.objectkey] = props;
90
- };
91
- /**
92
- * Get the rideable object with the specified object key.
93
- * @param {string} objectkey - The key of the rideable object to retrieve.
94
- * @returns {rideableType} The rideable object with the specified key.
95
- */
96
- var getRideable = function (objectkey) {
97
- return rideable[objectkey];
98
- };
99
- /**
100
- * Handle landing of a rideable object.
101
- * @param {string} objectkey - The key of the rideable object to land.
102
- */
103
- var landing = function (objectkey) {
104
- var activeState = worldContext.activeState, refs = worldContext.refs;
105
- states.enableRiding = false;
106
- states.isRiderOn = false;
107
- states.rideableId = null;
108
- var modeType = rideable[objectkey].objectType;
109
- var _a = getSizesByUrls(urls), vehicleUrl = _a.vehicleUrl, airplaneUrl = _a.airplaneUrl, characterUrl = _a.characterUrl;
110
- var size = modeType === "vehicle" ? vehicleUrl : airplaneUrl;
111
- var mySize = characterUrl;
112
- rideable[objectkey].visible = true;
113
- rideable[objectkey].position.copy(activeState.position.clone());
114
- if (refs && refs.rigidBodyRef) {
115
- refs.rigidBodyRef.current.setTranslation(activeState.position
116
- .clone()
117
- .add(size.clone().add(mySize.clone()).addScalar(1)), false);
118
- }
119
- dispatch({
120
- type: "update",
121
- payload: {
122
- rideable: __assign({}, rideable),
123
- states: __assign({}, states),
124
- activeState: __assign({}, activeState),
125
- },
126
- });
127
- };
128
- /**
129
- * Set the URL properties of a rideable object. (inner function)
130
- * @param {rideableType} props - The properties containing URLs for the rideable object.
131
- */
132
- var setUrl = function (props) { return __awaiter(_this, void 0, void 0, function () {
133
- return __generator(this, function (_a) {
134
- if (props.objectType === "vehicle") {
135
- urls.vehicleUrl = props.url;
136
- urls.wheelUrl = props.wheelUrl || null;
137
- }
138
- else if (props.objectType === "airplane") {
139
- urls.airplaneUrl = props.url;
140
- }
141
- dispatch({
142
- type: "update",
143
- payload: {
144
- urls: __assign({}, urls),
145
- },
146
- });
147
- return [2 /*return*/];
148
- });
149
- }); };
150
- /**
151
- * Set the mode and riding state for a rideable object. (inner function)
152
- * @param {rideableType} props - The properties of the rideable object to set mode and riding state.
153
- */
154
- var setModeAndRiding = function (props) { return __awaiter(_this, void 0, void 0, function () {
155
- return __generator(this, function (_a) {
156
- mode.type = props.objectType;
157
- states.enableRiding = props.enableRiding;
158
- states.isRiderOn = true;
159
- states.rideableId = props.objectkey;
160
- rideable[props.objectkey].visible = false;
161
- dispatch({
162
- type: "update",
163
- payload: {
164
- mode: __assign({}, mode),
165
- states: __assign({}, states),
166
- },
167
- });
168
- return [2 /*return*/];
169
- });
170
- }); };
171
- /**
172
- * Handle the ride event for a rideable object.
173
- * @param {CollisionEnterPayload} e - The collision event payload.
174
- * @param {rideableType} props - The properties of the rideable object.
175
- */
176
- var ride = function (e, props) { return __awaiter(_this, void 0, void 0, function () {
177
- return __generator(this, function (_a) {
178
- switch (_a.label) {
179
- case 0:
180
- if (!(e.other.rigidBodyObject.name === "character")) return [3 /*break*/, 3];
181
- return [4 /*yield*/, setUrl(props)];
182
- case 1:
183
- _a.sent();
184
- return [4 /*yield*/, setModeAndRiding(props)];
185
- case 2:
186
- _a.sent();
187
- _a.label = 3;
188
- case 3: return [2 /*return*/];
189
- }
190
- });
191
- }); };
192
- return {
193
- initRideable: initRideable,
194
- setRideable: setRideable,
195
- getRideable: getRideable,
196
- ride: ride,
197
- landing: landing,
198
- };
199
- }
@@ -1,3 +0,0 @@
1
- export declare function useTeleport(): {
2
- Teleport: (position: THREE.Vector3) => void;
3
- };
@@ -1,12 +0,0 @@
1
- import { useContext } from "react";
2
- import { GaesupWorldContext } from "../../world/context";
3
- export function useTeleport() {
4
- var refs = useContext(GaesupWorldContext).refs;
5
- var Teleport = function (position) {
6
- var _a, _b;
7
- (_b = (_a = refs.rigidBodyRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.setTranslation(position, true);
8
- };
9
- return {
10
- Teleport: Teleport,
11
- };
12
- }
@@ -1,2 +0,0 @@
1
- import { calcPropType } from "../type";
2
- export default function damping(prop: calcPropType): void;
@@ -1,5 +0,0 @@
1
- export default function damping(prop) {
2
- var rigidBodyRef = prop.rigidBodyRef, airplane = prop.controllerContext.airplane;
3
- var linearDamping = airplane.linearDamping;
4
- rigidBodyRef.current.setLinearDamping(linearDamping);
5
- }
@@ -1,2 +0,0 @@
1
- import { calcPropType } from "../type";
2
- export default function direction(prop: calcPropType): any;
@@ -1,65 +0,0 @@
1
- import { quat } from "@react-three/rapier";
2
- import { V3 } from "../../utils/vector";
3
- export default function direction(prop) {
4
- var innerGroupRef = prop.innerGroupRef, rigidBodyRef = prop.rigidBodyRef, _a = prop.worldContext, joystick = _a.joystick, activeState = _a.activeState, control = _a.control, mode = _a.mode, airplane = prop.controllerContext.airplane, matchSizes = prop.matchSizes;
5
- var forward = control.forward, backward = control.backward, leftward = control.leftward, rightward = control.rightward, shift = control.shift, space = control.space;
6
- var angleDelta = airplane.angleDelta, maxAngle = airplane.maxAngle, accelRatio = airplane.accelRatio;
7
- if (!matchSizes || !matchSizes["airplaneUrl"])
8
- return null;
9
- var boost = 0;
10
- if (mode.controller === "joystick") {
11
- boost = space
12
- ? Number(joystick.joyStickOrigin.isOn)
13
- : Number(joystick.joyStickOrigin.isOn) * accelRatio;
14
- }
15
- else {
16
- boost = space ? Number(shift) : Number(shift) * accelRatio;
17
- }
18
- var upDown = mode.controller === "joystick"
19
- ? joystick.joyStickOrigin.isUp
20
- ? -1
21
- : 1
22
- : Number(backward) - Number(forward);
23
- var leftRight = Number(rightward) - Number(leftward);
24
- var front = V3().set(boost, boost, boost);
25
- var _euler = activeState.euler.clone();
26
- var __euler = activeState.euler.clone();
27
- if (mode.controller === "joystick") {
28
- __euler.y = -Math.PI / 2 + joystick.joyStickOrigin.angle;
29
- activeState.euler.setFromQuaternion(quat().setFromEuler(_euler).slerp(quat().setFromEuler(__euler), 1));
30
- }
31
- else {
32
- activeState.euler.y += -leftRight * angleDelta.y;
33
- }
34
- var X = maxAngle.x * upDown;
35
- var Z = maxAngle.z * leftRight;
36
- var _x = innerGroupRef.current.rotation.x;
37
- var _z = innerGroupRef.current.rotation.z;
38
- var maxX = maxAngle.x;
39
- var maxZ = maxAngle.z;
40
- var innerGrounRefRotation = innerGroupRef.current.clone();
41
- if (_x < -maxX) {
42
- innerGrounRefRotation.rotation.x = -maxX + X;
43
- }
44
- else if (_x > maxX) {
45
- innerGrounRefRotation.rotation.x = maxX + X;
46
- }
47
- else {
48
- innerGrounRefRotation.rotateX(X);
49
- }
50
- if (_z < -maxZ)
51
- innerGrounRefRotation.rotation.z = -maxZ + Z;
52
- else if (_z > maxZ)
53
- innerGrounRefRotation.rotation.z = maxZ + Z;
54
- else
55
- innerGrounRefRotation.rotateZ(Z);
56
- activeState.euler.x = innerGrounRefRotation.rotation.x;
57
- activeState.euler.z = innerGrounRefRotation.rotation.z;
58
- innerGrounRefRotation.rotation.y = 0;
59
- innerGroupRef.current.setRotationFromQuaternion(quat()
60
- .setFromEuler(innerGroupRef.current.rotation.clone())
61
- .slerp(quat().setFromEuler(innerGrounRefRotation.rotation.clone()), 0.2));
62
- activeState.rotation = innerGrounRefRotation.rotation;
63
- activeState.direction = front.multiply(V3(Math.sin(activeState.euler.y), -upDown, Math.cos(activeState.euler.y)));
64
- activeState.dir = activeState.direction.normalize();
65
- }
@@ -1,14 +0,0 @@
1
- import { calcPropType } from "../type";
2
- /**
3
- * This function calculates and sets gravity.
4
- *
5
- * @param {calcPropType} prop - An object containing properties necessary for gravity calculation.
6
- * @param {object} prop.rigidBodyRef - A reference to the physical object where gravity is being set.
7
- * @param {object} prop.worldContext - An object representing the current state of the game world.
8
- * @param {number} prop.worldContext.activeState.position.y - The current Y-coordinate position.
9
- *
10
- * Gravity is calculated based on altitude and buoyancy. When altitude is less than 10, gravity is calculated as follows:
11
- * Gravity = ((1 - buoyancy) / (0 - 10)) * current Y-coordinate + buoyancy
12
- * Otherwise, gravity is set to 0.1.
13
- */
14
- export default function gravity(prop: calcPropType): void;
@@ -1,18 +0,0 @@
1
- /**
2
- * This function calculates and sets gravity.
3
- *
4
- * @param {calcPropType} prop - An object containing properties necessary for gravity calculation.
5
- * @param {object} prop.rigidBodyRef - A reference to the physical object where gravity is being set.
6
- * @param {object} prop.worldContext - An object representing the current state of the game world.
7
- * @param {number} prop.worldContext.activeState.position.y - The current Y-coordinate position.
8
- *
9
- * Gravity is calculated based on altitude and buoyancy. When altitude is less than 10, gravity is calculated as follows:
10
- * Gravity = ((1 - buoyancy) / (0 - 10)) * current Y-coordinate + buoyancy
11
- * Otherwise, gravity is set to 0.1.
12
- */
13
- export default function gravity(prop) {
14
- var rigidBodyRef = prop.rigidBodyRef, activeState = prop.worldContext.activeState, matchSizes = prop.matchSizes;
15
- rigidBodyRef.current.setGravityScale(activeState.position.y < 10
16
- ? ((1 - 0.1) / (0 - 10)) * activeState.position.y + 1
17
- : 0.1, false);
18
- }
@@ -1,16 +0,0 @@
1
- import { calcPropType } from "../type";
2
- /**
3
- * This function applies an impulse to a rigid body in the game world.
4
- *
5
- * @param {calcPropType} prop - An object containing properties necessary for applying the impulse.
6
- * @param {object} prop.rigidBodyRef - A reference to the rigid body to which the impulse is applied.
7
- * @param {object} prop.worldContext - An object representing the current state of the game world.
8
- * @param {object} prop.controllerContext - An object containing controller-specific context data.
9
- * @param {object} prop.controllerContext.airplane - An object representing the airplane controller context.
10
- * @param {number} prop.controllerContext.airplane.maxSpeed - The maximum speed of the airplane.
11
- *
12
- * This function calculates the current speed of the rigid body and compares it to the maximum speed.
13
- * If the current speed is greater than the maximum speed, no impulse is applied.
14
- * Otherwise, an impulse is applied to the rigid body in the direction specified by `activeState.direction`.
15
- */
16
- export default function impulse(prop: calcPropType): void;
@@ -1,31 +0,0 @@
1
- import { vec3 } from "@react-three/rapier";
2
- /**
3
- * This function applies an impulse to a rigid body in the game world.
4
- *
5
- * @param {calcPropType} prop - An object containing properties necessary for applying the impulse.
6
- * @param {object} prop.rigidBodyRef - A reference to the rigid body to which the impulse is applied.
7
- * @param {object} prop.worldContext - An object representing the current state of the game world.
8
- * @param {object} prop.controllerContext - An object containing controller-specific context data.
9
- * @param {object} prop.controllerContext.airplane - An object representing the airplane controller context.
10
- * @param {number} prop.controllerContext.airplane.maxSpeed - The maximum speed of the airplane.
11
- *
12
- * This function calculates the current speed of the rigid body and compares it to the maximum speed.
13
- * If the current speed is greater than the maximum speed, no impulse is applied.
14
- * Otherwise, an impulse is applied to the rigid body in the direction specified by `activeState.direction`.
15
- */
16
- export default function impulse(prop) {
17
- var rigidBodyRef = prop.rigidBodyRef, activeState = prop.worldContext.activeState, airplane = prop.controllerContext.airplane;
18
- var maxSpeed = airplane.maxSpeed;
19
- var velocity = rigidBodyRef.current.linvel();
20
- // a = v / t (t = 1) (approximate calculation)
21
- var V = vec3(velocity).length();
22
- if (V < maxSpeed) {
23
- var M = rigidBodyRef.current.mass();
24
- // impulse = mass * velocity
25
- rigidBodyRef.current.applyImpulse(vec3({
26
- x: activeState.direction.x,
27
- y: activeState.direction.y,
28
- z: activeState.direction.z,
29
- }).multiplyScalar(M), false);
30
- }
31
- }
@@ -1,2 +0,0 @@
1
- import { calcPropType } from "../type";
2
- export default function airplaneCalculation(calcProp: calcPropType): void;
@@ -1,14 +0,0 @@
1
- import damping from "./damping";
2
- import direction from "./direction";
3
- import gravity from "./gravity";
4
- import impulse from "./impulse";
5
- import innerCalc from "./innerCalc";
6
- import landing from "./landing";
7
- export default function airplaneCalculation(calcProp) {
8
- direction(calcProp);
9
- impulse(calcProp);
10
- damping(calcProp);
11
- gravity(calcProp);
12
- landing(calcProp);
13
- innerCalc(calcProp);
14
- }
@@ -1,2 +0,0 @@
1
- import { calcPropType } from "../type";
2
- export default function innerCalc(prop: calcPropType): void;
@@ -1,27 +0,0 @@
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
- };
12
- import { quat, vec3 } from "@react-three/rapier";
13
- export default function innerCalc(prop) {
14
- var rigidBodyRef = prop.rigidBodyRef, activeState = prop.worldContext.activeState, dispatch = prop.dispatch;
15
- activeState.position = vec3(rigidBodyRef.current.translation());
16
- activeState.velocity = vec3(rigidBodyRef.current.linvel());
17
- var _euler = activeState.euler.clone();
18
- _euler.x = 0;
19
- _euler.z = 0;
20
- rigidBodyRef.current.setRotation(quat().setFromEuler(_euler), true);
21
- dispatch({
22
- type: "update",
23
- payload: {
24
- activeState: __assign({}, activeState),
25
- },
26
- });
27
- }
@@ -1,2 +0,0 @@
1
- import { calcPropType } from "../type";
2
- export default function landing(prop: calcPropType): void;
@@ -1,29 +0,0 @@
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
- };
12
- export default function landing(prop) {
13
- var _a = prop.worldContext, states = _a.states, rideable = _a.rideable, mode = _a.mode, dispatch = prop.dispatch;
14
- var isLanding = states.isLanding;
15
- if (isLanding) {
16
- rideable.objectType = null;
17
- rideable.key = null;
18
- mode.type = "character";
19
- states.isLanding = false;
20
- states.enableRiding = false;
21
- }
22
- dispatch({
23
- type: "update",
24
- payload: {
25
- mode: __assign({}, mode),
26
- rideable: __assign({}, rideable),
27
- },
28
- });
29
- }
@@ -1,23 +0,0 @@
1
- import { RootState } from "@react-three/fiber";
2
- import { joyStickInnerType } from "../../tools/joyStick/type";
3
- import { activeStateType, modeType } from "../../world/context/type";
4
- import { calcPropType } from "../type";
5
- export declare function orbitDirection({ activeState, control, mode, joystick, state, }: {
6
- state: RootState;
7
- activeState: activeStateType;
8
- mode: modeType;
9
- joystick: joyStickInnerType;
10
- control: {
11
- [key: string]: boolean;
12
- };
13
- }): void;
14
- export declare function normalDirection({ activeState, control, mode, joystick, state, }: {
15
- state: RootState;
16
- activeState: activeStateType;
17
- mode: modeType;
18
- joystick: joyStickInnerType;
19
- control: {
20
- [key: string]: boolean;
21
- };
22
- }): void;
23
- export default function direction(prop: calcPropType): void;
@@ -1,55 +0,0 @@
1
- import { V3, calcAngleByVector } from "../../utils/vector";
2
- export function orbitDirection(_a) {
3
- var activeState = _a.activeState, control = _a.control, mode = _a.mode, joystick = _a.joystick, state = _a.state;
4
- var forward = control.forward, backward = control.backward, leftward = control.leftward, rightward = control.rightward;
5
- var dirX = Number(leftward) - Number(rightward);
6
- var dirZ = Number(forward) - Number(backward);
7
- var start = 0;
8
- if (mode.controller === "joystick") {
9
- if (joystick.joyStickOrigin.isCenter)
10
- return;
11
- activeState.euler.y = Math.PI / 2 - joystick.joyStickOrigin.angle;
12
- start = 1;
13
- }
14
- else {
15
- if (dirX === 0 && dirZ === 0)
16
- return;
17
- activeState.euler.y += (dirX * Math.PI) / 32;
18
- start = dirZ;
19
- }
20
- var front = V3(start, 0, start);
21
- activeState.direction = front.multiply(V3(-Math.sin(activeState.euler.y), 0, -Math.cos(activeState.euler.y)));
22
- activeState.dir = activeState.direction.normalize();
23
- }
24
- export function normalDirection(_a) {
25
- var activeState = _a.activeState, control = _a.control, mode = _a.mode, joystick = _a.joystick, state = _a.state;
26
- var forward = control.forward, backward = control.backward, leftward = control.leftward, rightward = control.rightward;
27
- var start = 0;
28
- if (mode.controller === "joystick") {
29
- if (joystick.joyStickOrigin.isCenter)
30
- return;
31
- activeState.euler.y = Math.PI / 2 - joystick.joyStickOrigin.angle;
32
- start = 1;
33
- }
34
- else {
35
- // 일반 컨트롤
36
- // right hand rule. north -> east -> south -> west
37
- var dirX = Number(leftward) - Number(rightward);
38
- var dirZ = Number(forward) - Number(backward);
39
- if (dirX === 0 && dirZ === 0)
40
- return;
41
- var dir = V3(dirX, 0, dirZ);
42
- var angle = calcAngleByVector(dir);
43
- activeState.euler.y = angle;
44
- activeState.dir.set(dirX, 0, dirZ);
45
- }
46
- }
47
- export default function direction(prop) {
48
- var state = prop.state, _a = prop.worldContext, joystick = _a.joystick, mode = _a.mode, activeState = _a.activeState, control = _a.control;
49
- if (mode.control === "normal") {
50
- normalDirection({ activeState: activeState, control: control, mode: mode, joystick: joystick, state: state });
51
- }
52
- else if (mode.control === "orbit") {
53
- orbitDirection({ activeState: activeState, control: control, mode: mode, joystick: joystick, state: state });
54
- }
55
- }
@@ -1,2 +0,0 @@
1
- import { calcPropType } from "../type";
2
- export default function impulse(prop: calcPropType): void;
@@ -1,43 +0,0 @@
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
- };
12
- import { vec3 } from "@react-three/rapier";
13
- export default function impulse(prop) {
14
- var rigidBodyRef = prop.rigidBodyRef, _a = prop.worldContext, states = _a.states, activeState = _a.activeState, dispatch = prop.dispatch;
15
- var isMoving = states.isMoving, isRunning = states.isRunning;
16
- var _b = prop.controllerContext.character, walkSpeed = _b.walkSpeed, runSpeed = _b.runSpeed, jumpSpeed = _b.jumpSpeed;
17
- var isOnTheGround = states.isOnTheGround, isJumping = states.isJumping;
18
- var impulse = vec3();
19
- if (isJumping && isOnTheGround) {
20
- impulse.setY(jumpSpeed * rigidBodyRef.current.mass());
21
- }
22
- if (isMoving) {
23
- var speed = isRunning ? runSpeed : walkSpeed;
24
- var velocity = vec3()
25
- .addScalar(speed)
26
- .multiply(activeState.dir.clone().normalize().negate());
27
- var M = rigidBodyRef.current.mass();
28
- // a = v / t = dv / 1 (dt = 1)
29
- var A = velocity.clone().sub(activeState.velocity);
30
- var F = A.multiplyScalar(M);
31
- impulse.setX(F.x);
32
- impulse.setZ(F.z);
33
- }
34
- rigidBodyRef.current.applyImpulse(impulse, true);
35
- activeState.position = vec3(rigidBodyRef.current.translation());
36
- activeState.velocity = vec3(rigidBodyRef.current.linvel());
37
- dispatch({
38
- type: "update",
39
- payload: {
40
- activeState: __assign({}, activeState),
41
- },
42
- });
43
- }
@@ -1,2 +0,0 @@
1
- import { calcPropType } from "../type";
2
- export default function characterCalculation(calcProp: calcPropType): void;
@@ -1,8 +0,0 @@
1
- import direction from "./direction";
2
- import impulse from "./impulse";
3
- import innerCalc from "./innerCalc";
4
- export default function characterCalculation(calcProp) {
5
- direction(calcProp);
6
- impulse(calcProp);
7
- innerCalc(calcProp);
8
- }
@@ -1,2 +0,0 @@
1
- import { calcPropType } from "../type";
2
- export default function innerCalc(prop: calcPropType): void;
@@ -1,31 +0,0 @@
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
- };
12
- import { quat, vec3 } from "@react-three/rapier";
13
- export default function innerCalc(prop) {
14
- var rigidBodyRef = prop.rigidBodyRef, innerGroupRef = prop.innerGroupRef, linearDamping = prop.controllerContext.character.linearDamping, _a = prop.worldContext, activeState = _a.activeState, states = _a.states, dispatch = prop.dispatch, delta = prop.delta;
15
- activeState.position = vec3(rigidBodyRef.current.translation());
16
- activeState.velocity = vec3(rigidBodyRef.current.linvel());
17
- if (states.isJumping || rigidBodyRef.current.linvel().y < 0) {
18
- rigidBodyRef.current.setLinearDamping(linearDamping);
19
- }
20
- else {
21
- rigidBodyRef.current.setLinearDamping(states.isNotMoving ? linearDamping * 5 : linearDamping);
22
- }
23
- rigidBodyRef.current.setEnabledRotations(false, false, false, false);
24
- innerGroupRef.current.quaternion.rotateTowards(quat().setFromEuler(activeState.euler), 10 * delta);
25
- dispatch({
26
- type: "update",
27
- payload: {
28
- activeState: __assign({}, activeState),
29
- },
30
- });
31
- }
@@ -1,2 +0,0 @@
1
- import { calcPropType } from "../type";
2
- export default function checkOnTheGround(prop: calcPropType): void;