fix init code
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -24,6 +24,7 @@ export const ItemSystem = () => {
|
|||||||
const mesh = sceneRegistry.nodes.get(id) as THREE.Object3D
|
const mesh = sceneRegistry.nodes.get(id) as THREE.Object3D
|
||||||
if (!mesh) return
|
if (!mesh) return
|
||||||
|
|
||||||
|
|
||||||
if (item.asset.attachTo === 'wall-side') {
|
if (item.asset.attachTo === 'wall-side') {
|
||||||
// Wall-attached item: offset Z by half the parent wall's thickness
|
// Wall-attached item: offset Z by half the parent wall's thickness
|
||||||
const parentWall = item.parentId ? nodes[item.parentId as AnyNodeId] : undefined
|
const parentWall = item.parentId ? nodes[item.parentId as AnyNodeId] : undefined
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ export const WallSystem = () => {
|
|||||||
const levelId = node.parentId
|
const levelId = node.parentId
|
||||||
if (!levelId) return
|
if (!levelId) return
|
||||||
|
|
||||||
|
|
||||||
if (!dirtyWallsByLevel.has(levelId)) {
|
if (!dirtyWallsByLevel.has(levelId)) {
|
||||||
dirtyWallsByLevel.set(levelId, new Set())
|
dirtyWallsByLevel.set(levelId, new Set())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { type AnyNodeId, type ItemNode, useRegistry, useScene } from '@pascal-app/core'
|
import { type AnyNodeId, type ItemNode, useRegistry, useScene } from '@pascal-app/core'
|
||||||
import { Clone } from '@react-three/drei/core/Clone'
|
import { Clone } from '@react-three/drei/core/Clone'
|
||||||
import { useGLTF } from '@react-three/drei/core/Gltf'
|
import { useGLTF } from '@react-three/drei/core/Gltf'
|
||||||
import { Suspense, useEffect, useRef } from 'react'
|
import { Suspense, useEffect, useMemo, useRef } from 'react'
|
||||||
import type { Group, Material, Mesh } from 'three'
|
import type { Group, Material, Mesh } from 'three'
|
||||||
import { MeshStandardNodeMaterial } from 'three/webgpu'
|
import { MeshStandardNodeMaterial } from 'three/webgpu'
|
||||||
import { useNodeEvents } from '../../../hooks/use-node-events'
|
import { useNodeEvents } from '../../../hooks/use-node-events'
|
||||||
@@ -57,12 +57,12 @@ const ModelRenderer = ({ node }: { node: ItemNode }) => {
|
|||||||
useScene.getState().dirtyNodes.add(node.parentId as AnyNodeId)
|
useScene.getState().dirtyNodes.add(node.parentId as AnyNodeId)
|
||||||
}, [node.parentId])
|
}, [node.parentId])
|
||||||
|
|
||||||
useEffect(() => {
|
useMemo(() => {
|
||||||
scene.traverse((child) => {
|
scene.traverse((child) => {
|
||||||
if ((child as Mesh).isMesh) {
|
if ((child as Mesh).isMesh) {
|
||||||
const mesh = child as Mesh
|
const mesh = child as Mesh
|
||||||
if (mesh.name === 'cutout') {
|
if (mesh.name === 'cutout') {
|
||||||
child.visible = false
|
child.visible = false;
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user