소스 검색

added SmoothTarget.ignoreTranslate

Nicolas Cannasse 4 년 전
부모
커밋
e4e2bd797e
1개의 변경된 파일10개의 추가작업 그리고 3개의 파일을 삭제
  1. 10 3
      h3d/anim/SmoothTarget.hx

+ 10 - 3
h3d/anim/SmoothTarget.hx

@@ -20,6 +20,7 @@ class SmoothTarget extends Animation {
 	@:s public var target : Animation;
 	@:s public var blend : Float;
 	@:s var duration : Float;
+	@:s public var ignoreTranslate = false;
 
 	public function new( target : h3d.anim.Animation, duration = 0.5 ) {
 		super("SmoothTarget(" + target.name+")", target.frameCount, target.sampling);
@@ -149,9 +150,15 @@ class SmoothTarget extends Animation {
 				mout._32 *= sz;
 				mout._33 *= sz;
 
-				mout.tx = lerp(o.tx, m.tx, blend);
-				mout.ty = lerp(o.ty, m.ty, blend);
-				mout.tz = lerp(o.tz, m.tz, blend);
+				if( ignoreTranslate ) {
+					mout.tx = m.tx;
+					mout.ty = m.ty;
+					mout.tz = m.tz;
+				} else {
+					mout.tx = lerp(o.tx, m.tx, blend);
+					mout.ty = lerp(o.ty, m.ty, blend);
+					mout.tz = lerp(o.tz, m.tz, blend);
+				}
 
 				@:privateAccess if( o.targetSkin != null ) o.targetSkin.currentRelPose[o.targetJoint] = mout else o.targetObject.defaultTransform = mout;
 			}