private void Flush() { if (m_Count != 0) { fixed(int *l = m_PairsLeft) { fixed(int *r = m_PairsRight) { for (int i = 0; i < m_Count; i++) { int bodyALocalIndex = l[i]; int bodyBLocalIndex = r[i]; if (m_BodyRespondsToCollisionLeft[bodyALocalIndex] && m_BodyRespondsToCollisionRight[bodyBLocalIndex]) { if (CollisionFilter.IsCollisionEnabled(m_BodyFiltersLeft[bodyALocalIndex], m_BodyFiltersRight[bodyBLocalIndex])) { m_CollidingPairs->Write(new BodyIndexPair { BodyIndexA = bodyALocalIndex + m_BodyIndexABase, BodyIndexB = bodyBLocalIndex + m_BodyIndexBBase }); } } } } } m_Count = 0; } }
public static unsafe void AabbCollider <T>(OverlapAabbInput input, [NoAlias] Collider *collider, [NoAlias] ref T collector) where T : struct, IOverlapCollector { if (!CollisionFilter.IsCollisionEnabled(input.Filter, collider->Filter)) { return; } switch (collider->Type) { case ColliderType.Mesh: AabbMesh(input, (MeshCollider *)collider, ref collector); break; case ColliderType.Compound: AabbCompound(input, (CompoundCollider *)collider, ref collector); break; case ColliderType.Terrain: AabbTerrain(input, (TerrainCollider *)collider, ref collector); break; default: SafetyChecks.ThrowNotImplementedException(); return; } }
public unsafe void AabbLeaf <T>(OverlapAabbInput input, int rigidBodyIndex, ref T collector) where T : struct, IOverlapCollector { rigidBodyIndex += BaseRigidBodyIndex; RigidBody body = m_Bodies[rigidBodyIndex]; if (body.Collider.IsCreated && CollisionFilter.IsCollisionEnabled(input.Filter, body.Collider.Value.Filter)) { collector.AddRigidBodyIndices(&rigidBodyIndex, 1); } }