feat: Replace crypto.randomUUID with generateUniqueId in MaterialSpawner and reduce spawnCount to 10
This commit is contained in:
@@ -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>(),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 />
|
||||||
|
|||||||
Reference in New Issue
Block a user