update : put every constante in the data folder
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
import { useEffect } from "react";
|
||||
import { useThree } from "@react-three/fiber";
|
||||
import type { Octree } from "three/addons/math/Octree.js";
|
||||
import {
|
||||
PLAYER_SPAWN_X,
|
||||
PLAYER_SPAWN_Y_DEFAULT,
|
||||
PLAYER_SPAWN_Z,
|
||||
} from "@/data/playerConfig";
|
||||
import { PlayerCamera } from "@/world/player/PlayerCamera";
|
||||
import { PlayerController } from "@/world/player/PlayerController";
|
||||
|
||||
@@ -11,12 +16,12 @@ interface PlayerComponentProps {
|
||||
|
||||
export function PlayerComponent({
|
||||
octree = null,
|
||||
spawnY = 100,
|
||||
spawnY = PLAYER_SPAWN_Y_DEFAULT,
|
||||
}: PlayerComponentProps): React.JSX.Element {
|
||||
const camera = useThree((state) => state.camera);
|
||||
|
||||
useEffect(() => {
|
||||
camera.position.set(0, spawnY, 0);
|
||||
camera.position.set(PLAYER_SPAWN_X, spawnY, PLAYER_SPAWN_Z);
|
||||
}, [camera, spawnY]);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user