浏览代码

Fx lookAt remove alloc

Tom SPIRA 4 年之前
父节点
当前提交
038ba89e73
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      hrt/prefab/fx/LookAt.hx

+ 2 - 1
hrt/prefab/fx/LookAt.hx

@@ -12,6 +12,7 @@ class LookAtObject extends h3d.scene.Object {
 	}
 	}
 
 
 	static var tmpMat = new h3d.Matrix();
 	static var tmpMat = new h3d.Matrix();
+	static var tmpVec = new h3d.Vector();
 	static var deltaVec = new h3d.Vector();
 	static var deltaVec = new h3d.Vector();
 	static var lookAtPos = new h3d.Vector();
 	static var lookAtPos = new h3d.Vector();
 	static var lockAxis = new h3d.Vector();
 	static var lockAxis = new h3d.Vector();
@@ -32,7 +33,7 @@ class LookAtObject extends h3d.scene.Object {
 		}
 		}
 
 
 		super.calcAbsPos();
 		super.calcAbsPos();
-		deltaVec.load(lookAtPos.sub(absPos.getPosition()));
+		deltaVec.load(lookAtPos.sub(absPos.getPosition(tmpVec)));
 		if(deltaVec.lengthSq() < 0.001)
 		if(deltaVec.lengthSq() < 0.001)
 			return;
 			return;