소스 검색

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