(Try 720p) Just a little test to check the speed of Box2D raycasting in a complex scene. The second part of the video shows 10,000 rays, which is so many that drawing a single pixel width line for all of them appears as a solid block of color. The maximum time for a raycast during the test can be seen in the top left: 0.004ms (average time is 0.0029ms).
Measurements taken on Core 2 Duo 3GHz.
Source code available here: http://www.iforce2d.net/b2djson/
Its too fast, so its possible to make pretty nice lightning model or such stuff! =D
Pr0glik 2 months ago
@Pr0glik well... depends what you are making. With 10,000 rays as in the video it's running at about 30fps, doing nothing else, so if you had other game code running I don't think it would be fast enough. But if you were to draw the rays thicker you could use less, I think even a few hundred would be plenty.
iforce2d 2 months ago