public override void Update(Window window, Camera camera, Input input, float dt) { frameIndex++; if (frameIndex % 64 == 0) { var bulletShape = new Sphere(0.5f + 5 * (float)random.NextDouble()); bulletShape.ComputeInertia(bulletShape.Radius * bulletShape.Radius * bulletShape.Radius, out var bulletInertia); var bulletShapeIndex = Simulation.Shapes.Add(bulletShape); var bodyDescription = BodyDescription.CreateConvexDynamic( new Vector3(0, 8, -130), new BodyVelocity(new Vector3(0, 0, 350)), bulletShape.Radius * bulletShape.Radius * bulletShape.Radius, Simulation.Shapes, bulletShape); Simulation.Bodies.Add(bodyDescription); } if (frameIndex % 192 == 0) { Simulation.Dispose(); BufferPool.Clear(); for (int i = 0; i < ThreadDispatcher.ThreadCount; ++i) { ThreadDispatcher.GetThreadMemoryPool(i).Clear(); } Initialize(null, camera); } base.Update(window, camera, input, dt); }