UNPKG

prendy

Version:

Make games with prerendered backdrops using babylonjs and repond

21 lines (20 loc) 800 B
import { Vector3 } from "@babylonjs/core"; import React, { Suspense } from "react"; import { useStore } from "repond"; import { usePlace } from "../helpers/babylonjs/usePlace/usePlace"; import { Player } from "./Player"; function Place({ name }) { usePlace(name); return null; } export function LoadingModels({ children }) { const { nowPlaceName } = useStore(({ global: { main } }) => main, { type: "global", id: "main", prop: ["nowPlaceName"], }); return (React.createElement(Suspense, { fallback: React.createElement("sphere", { name: "sphere1", diameter: 2, segments: 16, position: new Vector3(0, 1, 0) }) }, React.createElement(Player, null), React.createElement(Place, { name: nowPlaceName, key: nowPlaceName }), children)); }