@@ -153,6 +153,8 @@ def _init_collision_fields(self) -> None:
153153 self ._max_collision_pairs = min (n_possible_pairs , self ._solver ._max_collision_pairs )
154154 self ._max_contact_pairs = self ._max_collision_pairs * self ._n_contacts_per_pair
155155
156+ # FIXME: 'ti.static_print' cannot be used as it will be printed systematically, completely ignoring guard
157+ # condition, while 'print' is slowing down the kernel even if every called in practice...
156158 self ._warn_msg_max_collision_pairs = (
157159 f"{ colors .YELLOW } [Genesis] [00:00:00] [WARNING] Ignoring contact pair to avoid exceeding max "
158160 f"({ self ._max_contact_pairs } ). Please increase the value of RigidSolver's option "
@@ -777,7 +779,7 @@ def _func_broad_phase(self):
777779 continue
778780
779781 if self .n_broad_pairs [i_b ] == self ._max_collision_pairs :
780- ti . static_print (self ._warn_msg_max_collision_pairs )
782+ # print (self._warn_msg_max_collision_pairs)
781783 break
782784 self .broad_collision_pairs [self .n_broad_pairs [i_b ], i_b ][0 ] = i_ga
783785 self .broad_collision_pairs [self .n_broad_pairs [i_b ], i_b ][1 ] = i_gb
@@ -887,22 +889,27 @@ def _func_narrow_phase_convex_vs_convex(self):
887889 i_ga = self .broad_collision_pairs [i_pair , i_b ][0 ]
888890 i_gb = self .broad_collision_pairs [i_pair , i_b ][1 ]
889891
892+ if self ._solver .geoms_info [i_ga ].type > self ._solver .geoms_info [i_gb ].type :
893+ i_ga , i_gb = i_gb , i_ga
894+
890895 if (
891896 self ._solver .geoms_info [i_ga ].is_convex
892897 and self ._solver .geoms_info [i_gb ].is_convex
893898 and not self ._solver .geoms_info [i_gb ].type == gs .GEOM_TYPE .TERRAIN
894- and not (
895- self ._solver ._enable_multi_contact
896- and self ._solver .geoms_info [i_ga ].type == gs .GEOM_TYPE .PLANE
897- and self ._solver .geoms_info [i_gb ].type == gs .GEOM_TYPE .BOX
898- )
899899 and not (
900900 self ._solver ._box_box_detection
901901 and self ._solver .geoms_info [i_ga ].type == gs .GEOM_TYPE .BOX
902902 and self ._solver .geoms_info [i_gb ].type == gs .GEOM_TYPE .BOX
903903 )
904904 ):
905- self ._func_convex_convex_contact (i_ga , i_gb , i_b )
905+ if ti .static (sys .platform == "darwin" ):
906+ self ._func_convex_convex_contact (i_ga , i_gb , i_b )
907+ else :
908+ if not (
909+ self ._solver .geoms_info [i_ga ].type == gs .GEOM_TYPE .PLANE
910+ and self ._solver .geoms_info [i_gb ].type == gs .GEOM_TYPE .BOX
911+ ):
912+ self ._func_convex_convex_contact (i_ga , i_gb , i_b )
906913
907914 @ti .kernel
908915 def _func_narrow_phase_convex_specializations (self ):
@@ -915,15 +922,11 @@ def _func_narrow_phase_convex_specializations(self):
915922 if self ._solver .geoms_info [i_ga ].type > self ._solver .geoms_info [i_gb ].type :
916923 i_ga , i_gb = i_gb , i_ga
917924
918- if (
919- self ._solver .geoms_info [i_ga ].type == gs .GEOM_TYPE .PLANE
920- and self ._solver .geoms_info [i_gb ].type == gs .GEOM_TYPE .BOX
921- ):
922- if ti .static (sys .platform == "darwin" ):
923- # FIXME: It seems redundant, why don't we just call _func_plane_box_contact directly?
924- # Anyway in this function, we will call _func_plane_box_contact.
925- self ._func_convex_convex_contact (i_ga , i_gb , i_b )
926- else :
925+ if ti .static (sys .platform != "darwin" ):
926+ if (
927+ self ._solver .geoms_info [i_ga ].type == gs .GEOM_TYPE .PLANE
928+ and self ._solver .geoms_info [i_gb ].type == gs .GEOM_TYPE .BOX
929+ ):
927930 self ._func_plane_box_contact (i_ga , i_gb , i_b )
928931
929932 if ti .static (self ._solver ._box_box_detection ):
@@ -1110,7 +1113,10 @@ def _func_add_contact(self, i_ga, i_gb, normal, contact_pos, penetration, i_b):
11101113 i_col = self .n_contacts [i_b ]
11111114
11121115 if i_col == self ._max_contact_pairs :
1113- ti .static_print (self ._warn_msg_max_collision_pairs )
1116+ # FIXME: 'ti.static_print' cannot be used as it will be printed systematically, completely ignoring guard
1117+ # condition, while 'print' is slowing down the kernel even if every called in practice...
1118+ # print(self._warn_msg_max_collision_pairs)
1119+ pass
11141120 else :
11151121 ga_info = self ._solver .geoms_info [i_ga ]
11161122 gb_info = self ._solver .geoms_info [i_gb ]
@@ -1194,9 +1200,6 @@ def _func_contact_orthogonals(self, i_ga, i_gb, normal, i_b):
11941200
11951201 @ti .func
11961202 def _func_convex_convex_contact (self , i_ga , i_gb , i_b ):
1197- if self ._solver .geoms_info [i_ga ].type > self ._solver .geoms_info [i_gb ].type :
1198- i_ga , i_gb = i_gb , i_ga
1199-
12001203 if (
12011204 self ._solver .geoms_info [i_ga ].type == gs .GEOM_TYPE .PLANE
12021205 and self ._solver .geoms_info [i_gb ].type == gs .GEOM_TYPE .BOX
0 commit comments