27-06-2017, 01:49 PM
Hi all,
Im looking to see if it's possible to have the Obi Rope collide with essentially everything in the scene. From reading the docs it seems the only performance issue is during the transfer between C# and C++, which is a performance hit we're fine with having at the start assuming that's the only place it is present.
My current solution is to run something like this:
in the Start() method. This runs fine, but then Unity promptly crashes on the following first frame. The number of colliders is around 924. My main questions stemming from this are as follows;
I would assume the solution should this not be possible is to simply cherry pick the most important colliders.
Thanks for your response!
Im looking to see if it's possible to have the Obi Rope collide with essentially everything in the scene. From reading the docs it seems the only performance issue is during the transfer between C# and C++, which is a performance hit we're fine with having at the start assuming that's the only place it is present.
My current solution is to run something like this:
Code:
/// <summary>
/// Collects all the MeshColliders in the scene and attached it to ObiSolver
/// </summary>
private void CollectAllColliders()
{
//Get all mesh colliders in the scene
MeshCollider[] allColliders = FindObjectsOfType<MeshCollider>();
//Make a collider group
Obi.ObiColliderGroup colGroup = new Obi.ObiColliderGroup();
colGroup.colliders = new List<Collider>(allColliders);
//Attach it to the solver
ObiSolver.colliderGroup = colGroup;
}
in the Start() method. This runs fine, but then Unity promptly crashes on the following first frame. The number of colliders is around 924. My main questions stemming from this are as follows;
- Is this approach possible, but we're just exceeding some kind of upper-limit with colliders?
- Is there an alternate approach to getting all possible colliders to interact with a single rope instance?
- Does the performance hit from C#->C++ happen only st the start when they're registered, or every frame as their positions are updated?
I would assume the solution should this not be possible is to simply cherry pick the most important colliders.
Thanks for your response!