Radius coverage

Hi

How would the radius coverage for a circle work.
This is currently done on a square map so if my radius fills a portion of a square, is this area counted to cover that full square?

Hi,

We don’t work on a grid system for any of the object placement or collision logic so there are no world “squares”. If the engine picks up that any collision detection needs to be done it uses the center points of the objects in question and their radiuses to calculate if it is a true collision by checking the distance between the objects and the sum of the radiuses.

So in essence we don’t define each point on the circumference of the circle but rather see the edge as a function of the center and radius. I hope this answers your question?

Jana

2 Likes

Hi Jana, thanks for the answer, I’m just trying to understand coverage here, in the sense of a radius of 10 and the centre been 0,0 would that 10 extend to (10,0), (-10,0),(0,10),(0,-10) or am I misunderstanding the radius size of an object/player from the center point?

I know you mentioned there are no square here so if I have to take degrees into account, could my edges fill partially into an a coordinate as opposed to fully filling a coordinate?

Hi,

You are correct with the size and extent of the object, (10,0), (-10,0), (0,10), (0,-10). So all the elements in the world are integer based which means that you will either fill a certain point or not, so there won’t be any decimal positions. If calculations give decimals we round them consistently, either to ceiling or standard rounding (you can check the exact calculations in the VectorCalculationService in the game engine) to avoid the problem of partially being in a location.

Jana

1 Like

Hi Jana, can the rounding other than ceil be specified in the documentation?.

Different languages have different methods for rounding. Java’s Math.round will round to positive infinity, but C# rounds to even by default for midpoints. 2.5 is rounded to 3 and 2 in Java and C# respectively.

Python aligns with C#, while JS and Java agree with each other. I haven’t checked other languages.

If someone isn’t expecting this, they might get unexpected results, although this difference is only for exact midpoints.

Thanks!

Hi @clbuttic

We will add to the documentation which calculations are rounded vs which use a ceiling approach.

As you mentioned, .NET Core implements Math.Round as a round to even approach. Thus, the engine will do that too.

1 Like