+VG_STATIC int gate_intersect( ent_gate *gate, v3f pos, v3f last )
+{
+ v2f xy;
+
+ if( gate_intersect_plane( gate, pos, last, xy ) ){
+ if( fabsf(xy[0]) <= 1.0f && fabsf(xy[1]) <= 1.0f ){
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+/*
+ * Intersect all gates in the world
+ */
+VG_STATIC ent_gate *world_intersect_gates( world_instance *world,
+ v3f pos, v3f last )
+{
+ for( u32 i=0; i<mdl_arrcount(&world->ent_gate); i++ ){
+ ent_gate *gate = mdl_arritm( &world->ent_gate, i );
+ if( gate->type == k_gate_type_unlinked ||
+ gate->type == k_gate_type_nonlocal_unlinked )
+ continue;
+
+ if( gate_intersect( gate, pos, last ) ){
+ return gate;
+ }
+ }
+
+ return NULL;
+}
+