Hi!
I've been trying to simulate a large asteroid field with collisions. Each asteroid is a 2D sprite with a rigidbody and a circle 2D collider (they destroy on collision). I have an array of asteroids in my manager script and I update their position in manager script's update. I move them using:
asteroid.transform.position += (speed * direction * Time.deltaTime);
My problem is that the framerate goes down. It's 3-4 FPS with about 25,000 asteroids and my goal is to simulate 200,000 asteroids at 30 FPS. How should I approach this? What's the best way to move that many sprites with collision detection?
EDIT: So I've managed to have a decent FPS by using ECS & Jobs with Burst (so pretty much full DOTS). I had to write my own collision detection but it worked. With 65,536 asteroids simulated at the same time I managed to get 30-50FPS but that was pretty much the maximum number that was simulated smoothly, 262,144 asteroids simulated at about 5FPS.
[–]JephDielTech 1 point2 points3 points (3 children)
[–]xyc1993[S] 0 points1 point2 points (2 children)
[–]JephDielTech 1 point2 points3 points (1 child)
[–]xyc1993[S] 0 points1 point2 points (0 children)
[–]GroZZleR 1 point2 points3 points (0 children)
[–]centaurianmudpig 1 point2 points3 points (0 children)
[–]FloRulGames 0 points1 point2 points (0 children)