fix: armor mesh rotation dysync

This commit is contained in:
TrèsAbhi committed 2024-02-22 18:36:21 -06:00
1 parent e33ae0f81b
commit bc211822aa
7 files changed
+17 -24

No files matched your search

+4 -2
View File
@@ -1,10 +1,11 @@
import { MeshProps } from '@react-three/fiber';
import { Mesh, Object3D } from 'three';
export function jsxTree(node: Object3D, mesh?: MeshProps) {
export function jsxTree(node: Object3D, mesh?: MeshProps, key?: string) {
if (node instanceof Mesh) {
return (
<mesh
key={key}
geometry={node.geometry}
material={node.material}
position={node.position}
@@ -16,11 +17,12 @@ export function jsxTree(node: Object3D, mesh?: MeshProps) {
} else if (node instanceof Object3D) {
return (
<group
key={key}
position={node.position}
rotation={node.rotation}
scale={node.scale}
>
{node.children.map((child) => jsxTree(child, mesh))}
{node.children.map((child) => jsxTree(child, mesh, child.uuid))}
</group>
);
}