So I’m at the point when I’m in need for more precise Entities overlapping checks.
But I don’t want to use physics simulations or even update colliders position since I’m trying to achieve very-high performance.
All of the Unity.Physics Colliders have extension methods for cast and overlap checks.
I havent tried them but the code should look something like this.
var collider = new BoxCollider
{
Geometry = new BoxGeometry
{
Center = default(float3),
Orientation = default(quaternion),
Size = default(float3)
}
};
collider.CheckSphere(default(float3), default(float), default(CollisionFilter));
Do I have to initialize physics in some special way ?
Not quite. It seems that the collider has to be initialized.
var g = new Unity.Physics.SphereGeometry
{
Center = default,
Radius = 1
};
var s = new Unity.Physics.SphereCollider();
s.Initialize(g, CollisionFilter.Default, Unity.Physics.Material.Default);
Debug.Log(s.CheckSphere(default, 1, CollisionFilter.Default));
This returns true for me.
Keep in mind that i dont know if this is the intended way to do this.