gaesup-world 0.8.41 → 0.8.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,17 +1,6 @@
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
1
  import { vec3 } from "@react-three/rapier";
13
2
  export default function impulse(prop) {
14
- var rigidBodyRef = prop.rigidBodyRef, _a = prop.worldContext, states = _a.states, activeState = _a.activeState, clicker = _a.clicker, clickerOption = _a.clickerOption, dispatch = prop.dispatch;
3
+ var rigidBodyRef = prop.rigidBodyRef, _a = prop.worldContext, states = _a.states, activeState = _a.activeState;
15
4
  var isMoving = states.isMoving, isRunning = states.isRunning;
16
5
  var _b = prop.controllerContext.character, walkSpeed = _b.walkSpeed, runSpeed = _b.runSpeed, jumpSpeed = _b.jumpSpeed;
17
6
  var isOnTheGround = states.isOnTheGround, isJumping = states.isJumping;
@@ -34,10 +23,4 @@ export default function impulse(prop) {
34
23
  rigidBodyRef.current.applyImpulse(impulse, true);
35
24
  activeState.position = vec3(rigidBodyRef.current.translation());
36
25
  activeState.velocity = vec3(rigidBodyRef.current.linvel());
37
- dispatch({
38
- type: "update",
39
- payload: {
40
- activeState: __assign({}, activeState),
41
- },
42
- });
43
26
  }
@@ -2,16 +2,22 @@ import { vec3 } from "@react-three/rapier";
2
2
  import { calcNorm } from "../../utils";
3
3
  export default function stop(prop) {
4
4
  var _a;
5
- var rigidBodyRef = prop.rigidBodyRef, _b = prop.worldContext, control = _b.control, clicker = _b.clicker, mode = _b.mode, clickerOption = _b.clickerOption, activeState = _b.activeState;
5
+ var rigidBodyRef = prop.rigidBodyRef, _b = prop.worldContext, control = _b.control, clicker = _b.clicker, mode = _b.mode, clickerOption = _b.clickerOption;
6
6
  var keyS = control.keyS;
7
7
  if (keyS && mode.controller === "clicker") {
8
8
  clicker.isOn = false;
9
9
  clicker.isRun = false;
10
10
  }
11
- // 목적지 도착 (클리커 막기 로직)
12
11
  var u = vec3((_a = rigidBodyRef.current) === null || _a === void 0 ? void 0 : _a.translation());
13
12
  var norm = calcNorm(u, clicker.point, false);
14
- if ((norm < 1 || clickerOption.autoStart) && mode.controller === "clicker") {
13
+ if (clickerOption.autoStart) {
14
+ clicker.isOn = true;
15
+ norm = calcNorm(u, clickerOption.queue[0], false);
16
+ var v = vec3(clickerOption.queue[0]);
17
+ var newAngle = Math.atan2(v.z - u.z, v.x - u.x);
18
+ clicker.angle = newAngle;
19
+ }
20
+ if (norm < 1 && mode.controller === "clicker") {
15
21
  if (clickerOption.track && clickerOption.queue.length !== 0) {
16
22
  clicker.point = clickerOption.queue.shift();
17
23
  var v = vec3(clicker.point);
@@ -7,9 +7,11 @@ export function Clicker(_a) {
7
7
  var _b = useContext(GaesupWorldContext), clicker = _b.clicker, mode = _b.mode, clickerOption = _b.clickerOption;
8
8
  return (_jsxs(_Fragment, { children: [mode.controller === "clicker" && (_jsxs("group", { position: clicker.point, children: [clicker.isOn && onMarker, clicker.isOn && clickerOption.isRun && clicker.isRun && runMarker] })), clickerOption.line &&
9
9
  clickerOption.queue.map(function (item, key) {
10
- return (_jsxs("group", { position: [0, 1, 0], children: [key >= 1 && (_jsx(Line, { worldUnits: true, points: [
11
- clickerOption.queue[key - 1],
12
- clickerOption.queue[key],
13
- ], color: "turquoise", transparent: true, opacity: 0.5, lineWidth: 0.4 })), _jsxs("mesh", { position: item, children: [_jsx("sphereGeometry", { args: [0.6, 30, 0.6] }), _jsx("meshStandardMaterial", { color: "turquoise", transparent: true, opacity: 0.8 })] }, key)] }));
10
+ var current = key;
11
+ var before = key === 0 ? clickerOption.queue.length - 1 : key - 1;
12
+ return (_jsxs("group", { position: [0, 1, 0], children: [_jsx(Line, { worldUnits: true, points: [
13
+ clickerOption.queue[before],
14
+ clickerOption.queue[current],
15
+ ], color: "turquoise", transparent: true, opacity: 0.5, lineWidth: 0.4 }), _jsxs("mesh", { position: item, children: [_jsx("sphereGeometry", { args: [0.6, 30, 0.6] }), _jsx("meshStandardMaterial", { color: "turquoise", transparent: true, opacity: 0.8 })] }, key)] }));
14
16
  })] }));
15
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gaesup-world",
3
- "version": "0.8.41",
3
+ "version": "0.8.43",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",