Skip to content

Commit

Permalink
bugfix: interpolation failures while using TransformTrackBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Oct 6, 2023
1 parent 776d1d9 commit 312eee2
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
import com.jme3.anim.TransformTrack;
import com.jme3.anim.util.HasLocalTransform;
import com.jme3.math.Quaternion;
import com.jme3.math.Transform;
import com.jme3.math.Vector3f;
import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -107,6 +108,14 @@ public TransformTrackBuilder(HasLocalTransform target, float duration) {

this.target = target;
this.duration = duration;
/*
* Give each track component a keyframe at t=0
* to ensure interpolation will work:
*/
Transform t = target.getLocalTransform();
addRotation(0f, t.getRotation());
addScale(0f, t.getScale());
addTranslation(0f, t.getTranslation());
}
// *************************************************************************
// new methods exposed
Expand Down

0 comments on commit 312eee2

Please sign in to comment.