gaesup-world 0.9.57 → 0.9.58

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,18 +1,16 @@
1
- import { useContext } from "react";
2
1
  import * as THREE from "three";
3
- import { GaesupWorldContext } from "../../world/context";
4
2
 
5
3
  export function useTeleport() {
6
- const worldContext = useContext(GaesupWorldContext);
4
+ // const worldContext = useContext(GaesupWorldContext);
7
5
 
8
6
  const Teleport = (position: THREE.Vector3) => {
9
- if (
10
- worldContext &&
11
- worldContext?.refs &&
12
- worldContext?.refs?.rigidBodyRef &&
13
- worldContext?.refs?.rigidBodyRef?.current
14
- )
15
- worldContext.refs.rigidBodyRef.current.setTranslation(position, true);
7
+ // if (
8
+ // worldContext &&
9
+ // worldContext?.refs &&
10
+ // worldContext?.refs?.rigidBodyRef &&
11
+ // worldContext?.refs?.rigidBodyRef?.current
12
+ // )
13
+ // worldContext.refs.rigidBodyRef.current.setTranslation(position, true);
16
14
  };
17
15
 
18
16
  return {
@@ -1,80 +1,72 @@
1
1
  // Rideable.tsx
2
- import { CollisionEnterPayload, euler } from "@react-three/rapier";
3
- import { useContext, useEffect, useState } from "react";
4
- import * as THREE from "three";
5
- import { PassiveAirplane } from "../../component/passive/airplane";
6
- import { PassiveVehicle } from "../../component/passive/vehicle";
7
- import { useRideable } from "../../hooks/useRideable";
8
- import { V3 } from "../../utils";
9
- import { GaesupWorldContext } from "../../world/context";
10
2
  import { rideablePropType } from "./type";
11
3
 
12
4
  export function Rideable(props: rideablePropType) {
13
- const { states, rideable } = useContext(GaesupWorldContext);
14
- const { initRideable, ride, landing } = useRideable();
15
- const [_rideable] = useState<{
16
- position: THREE.Vector3;
17
- rotation: THREE.Euler;
18
- }>({
19
- position: props.position || V3(0, 0, 0),
20
- rotation: props.rotation || euler(),
21
- });
22
-
23
- useEffect(() => {
24
- initRideable(props);
25
- }, []);
26
-
27
- useEffect(() => {
28
- if (
29
- states?.isRiding &&
30
- rideable[props.objectkey] &&
31
- !rideable[props.objectkey].visible
32
- ) {
33
- landing(props.objectkey);
34
- }
35
- }, [states?.isRiding]);
36
-
37
- const onIntersectionEnter = async (e: CollisionEnterPayload) => {
38
- await ride(e, props);
39
- };
40
-
41
- return (
42
- <>
43
- {rideable?.[props.objectkey]?.visible && (
44
- <group userData={{ intangible: true }}>
45
- {props.objectType === "vehicle" && (
46
- <PassiveVehicle
47
- controllerOptions={props.controllerOptions}
48
- position={_rideable.position}
49
- rotation={_rideable.rotation}
50
- currentAnimation={"idle"}
51
- url={props.url}
52
- wheelUrl={props.wheelUrl}
53
- ridingUrl={props.ridingUrl}
54
- offset={props.offset}
55
- enableRiding={props.enableRiding}
56
- rigidBodyProps={props.rigidBodyProps}
57
- sensor={true}
58
- onIntersectionEnter={onIntersectionEnter}
59
- />
60
- )}
61
- {props.objectType === "airplane" && (
62
- <PassiveAirplane
63
- controllerOptions={props.controllerOptions}
64
- position={_rideable.position.clone()}
65
- rotation={_rideable.rotation.clone()}
66
- currentAnimation={"idle"}
67
- url={props.url}
68
- ridingUrl={props.ridingUrl}
69
- offset={props.offset}
70
- enableRiding={props.enableRiding}
71
- rigidBodyProps={props.rigidBodyProps}
72
- sensor={true}
73
- onIntersectionEnter={onIntersectionEnter}
74
- />
75
- )}
76
- </group>
77
- )}
78
- </>
79
- );
5
+ // const { states, rideable } = useContext(GaesupWorldContext);
6
+ // const { initRideable, ride, landing } = useRideable();
7
+ // const [_rideable] = useState<{
8
+ // position: THREE.Vector3;
9
+ // rotation: THREE.Euler;
10
+ // }>({
11
+ // position: props.position || V3(0, 0, 0),
12
+ // rotation: props.rotation || euler(),
13
+ // });
14
+ //
15
+ // useEffect(() => {
16
+ // initRideable(props);
17
+ // }, []);
18
+ //
19
+ // useEffect(() => {
20
+ // if (
21
+ // states?.isRiding &&
22
+ // rideable[props.objectkey] &&
23
+ // !rideable[props.objectkey].visible
24
+ // ) {
25
+ // landing(props.objectkey);
26
+ // }
27
+ // }, [states?.isRiding]);
28
+ //
29
+ // const onIntersectionEnter = async (e: CollisionEnterPayload) => {
30
+ // await ride(e, props);
31
+ // };
32
+ //
33
+ // return (
34
+ // <>
35
+ // {rideable?.[props.objectkey]?.visible && (
36
+ // <group userData={{ intangible: true }}>
37
+ // {props.objectType === "vehicle" && (
38
+ // <PassiveVehicle
39
+ // controllerOptions={props.controllerOptions}
40
+ // position={_rideable.position}
41
+ // rotation={_rideable.rotation}
42
+ // currentAnimation={"idle"}
43
+ // url={props.url}
44
+ // wheelUrl={props.wheelUrl}
45
+ // ridingUrl={props.ridingUrl}
46
+ // offset={props.offset}
47
+ // enableRiding={props.enableRiding}
48
+ // rigidBodyProps={props.rigidBodyProps}
49
+ // sensor={true}
50
+ // onIntersectionEnter={onIntersectionEnter}
51
+ // />
52
+ // )}
53
+ // {props.objectType === "airplane" && (
54
+ // <PassiveAirplane
55
+ // controllerOptions={props.controllerOptions}
56
+ // position={_rideable.position.clone()}
57
+ // rotation={_rideable.rotation.clone()}
58
+ // currentAnimation={"idle"}
59
+ // url={props.url}
60
+ // ridingUrl={props.ridingUrl}
61
+ // offset={props.offset}
62
+ // enableRiding={props.enableRiding}
63
+ // rigidBodyProps={props.rigidBodyProps}
64
+ // sensor={true}
65
+ // onIntersectionEnter={onIntersectionEnter}
66
+ // />
67
+ // )}
68
+ // </group>
69
+ // )}
70
+ // </>
71
+ // );
80
72
  }
@@ -3,6 +3,7 @@ import * as THREE from "three";
3
3
  import { controllerOptionsType } from "../../controller/type";
4
4
 
5
5
  export type rideablePropType = {
6
+ groundRay: any;
6
7
  objectkey: string;
7
8
  objectType?: "vehicle" | "airplane";
8
9
  controllerOptions: controllerOptionsType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gaesup-world",
3
- "version": "0.9.57",
3
+ "version": "0.9.58",
4
4
  "type": "module",
5
5
  "main": "dist/index.ts",
6
6
  "types": "dist/index.d.ts",