- Home /
Most Efficient Region Method?
This might be more of an advanced question, but what I'm trying to do is create a series of regions on a map, in this case a 1000x1000 terrain. Players will only be able to interact with objects in regions they control, and many kinds of objects can move between regions freely. Regions should not have any empty space between them. I expect a map to contain maybe 5-10 regions. There are two methods for doing this that I can think of, but I can't really decide which would be the most efficient. Efficiency is paramount.
the first is to use very large mesh colliders, and then when objects leave one and travel to another their referenced region will update, or alternatively each region would have a list of all the interactible objects which gets updated any time those objects move between regions. I think there's also a call to just check if a point is within a collider's bounds.
The second is to make regions into a series of vector2s since I only really care about the x and z spatially, height of the object wont matter in terms of interactivity. Then when an object is interacted with it would pass its position off to some kind of region manager that would then math out which region its in - not dissimilar to this http://wiki.unity3d.com/index.php/PolyContainsPoint
There might be other solutions to this that I'm not thinking of and I'm open to suggestions, but I could use some advice on this.
Your answer
Follow this Question
Related Questions
Applying transparency to regions of layers 0 Answers
physics.OverlapSphere colliders 1 Answer
Small colliders go through objects 0 Answers
Why vehicle decelerate on steerAngle 0 Answers
Coin collecting with prefabs 2 Answers