瀏覽代碼

small optimization

cxgeorge 24 年之前
父節點
當前提交
b050bd8459
共有 1 個文件被更改,包括 15 次插入6 次删除
  1. 15 6
      panda/src/collide/collisionHandlerPusher.cxx

+ 15 - 6
panda/src/collide/collisionHandlerPusher.cxx

@@ -172,19 +172,28 @@ handle_entries() {
           }
         }
 
-        if (_horizontal) {
-          net_shove[2] = 0.0;
+        LMatrix4f mat;
+        def.get_mat(mat);
+
+        // def.set_mat(LMatrix4f::translate_mat(net_shove) * mat);
+
+        mat(3,0) += net_shove[0];
+        mat(3,1) += net_shove[1];
+
+        if (!_horizontal) {
+          mat(3,2) += net_shove[2];
         }
 
+        def.set_mat(mat);
+
         if (collide_cat.is_debug()) {
+          if (_horizontal)
+             net_shove[2] = 0.0;
+
           collide_cat.debug()
             << "Net shove on " << *from_node << " is: "
             << net_shove << "\n";
         }
-
-        LMatrix4f mat;
-        def.get_mat(mat);
-        def.set_mat(LMatrix4f::translate_mat(net_shove) * mat);
       }
     }
   }