Im currently using the Unity Engine and the Box2D Physics Engine.
I have this line of code:
"RaycastHit2D ray = Physics2D.Raycast(origin, direction, distance);"
Im planning to use this line of code ... like "a lot" times (maybe like 100.000 times per frame)
And I have 3 simple Questions about Raycasting and Performance:
- How much does 1 Raycast cost (approximately).
- Is the Raycast processed by the CPU now or by the GPU?
- Does the number of the BoxColliders affect the cost of the Raycast? (for example: If I have 1000.000 Tiles on the map which have box Colliders, does one ray has the same performance cost as if i would have 1 single Tile? And if I have 1000.000 tiles - is the cost millionfold then?