feat: Replace crypto.randomUUID with generateUniqueId in MaterialSpawner and reduce spawnCount to 10

This commit is contained in:
2025-07-17 18:00:55 +05:30
parent 8191e955ca
commit d4d66d9d32
2 changed files with 3 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ import { MaterialModel } from '../../simulation/materials/instances/material/mat
import { useThree } from '@react-three/fiber'; import { useThree } from '@react-three/fiber';
import * as THREE from 'three'; import * as THREE from 'three';
import { CameraControls } from '@react-three/drei'; import { CameraControls } from '@react-three/drei';
import { generateUniqueId } from '../../../functions/generateUniqueId';
type MaterialSpawnerProps = { type MaterialSpawnerProps = {
position: [number, number, number]; position: [number, number, number];
@@ -39,7 +40,7 @@ function MaterialSpawner({ position, spawnInterval, spawnCount }: MaterialSpawne
return [ return [
...prev, ...prev,
{ {
id: crypto.randomUUID(), id: generateUniqueId(),
position, position,
ref: React.createRef<RapierRigidBody>(), ref: React.createRef<RapierRigidBody>(),
} }

View File

@@ -85,7 +85,7 @@ export default function Scene({ layout }: { readonly layout: 'Main Layout' | 'Co
<MaterialSpawner <MaterialSpawner
position={[-21, 3, -8]} position={[-21, 3, -8]}
spawnInterval={1000} spawnInterval={1000}
spawnCount={50} spawnCount={10}
/> />
</Physics> </Physics>
<Visualization /> <Visualization />