+
+ /* FIXME: only need to test against the visible gate....
+ * OR... bvh */
+
+ for( int i=0; i<world.gate_count; i++ )
+ {
+ struct route_gate *rg = &world.gates[i];
+ teleport_gate *gate = &rg->gate;
+
+ if( gate_intersect( gate, player->rb.co, player->prev_position ) )
+ {
+ player->dev.device->gate_transport( player, &player->dev, gate );
+ v3_copy( player->rb.co, player->prev_position );
+
+ /* Pre-emptively edit the camera matrices so that the motion vectors
+ * are correct */
+ m4x3f transport_i;
+ m4x4f transport_4;
+ m4x3_invert_affine( gate->transport, transport_i );
+ m4x3_expand( transport_i, transport_4 );
+ m4x4_mul( main_camera->mtx.pv, transport_4, main_camera->mtx.pv );
+ m4x4_mul( main_camera->mtx.v, transport_4, main_camera->mtx.v );
+ }
+ }