diff --git a/engine/src/core/com/jme3/animation/BoneTrack.java b/engine/src/core/com/jme3/animation/BoneTrack.java index 98dbc18ad..7fcf7fbd6 100644 --- a/engine/src/core/com/jme3/animation/BoneTrack.java +++ b/engine/src/core/com/jme3/animation/BoneTrack.java @@ -252,6 +252,13 @@ public final class BoneTrack implements Track { target.setAnimTransforms(tempV, tempQ, scales != null ? tempS : null); } } + + /** + * @return the length of the track + */ + public float getLength() { + return times == null ? 0 : times[times.length - 1] - times[0]; + } /** * This method creates a clone of the current object. diff --git a/engine/src/core/com/jme3/animation/PoseTrack.java b/engine/src/core/com/jme3/animation/PoseTrack.java index 72063547f..b61de5a9d 100644 --- a/engine/src/core/com/jme3/animation/PoseTrack.java +++ b/engine/src/core/com/jme3/animation/PoseTrack.java @@ -144,6 +144,13 @@ public final class PoseTrack implements Track { } } + /** + * @return the length of the track + */ + public float getLength() { + return times == null ? 0 : times[times.length - 1] - times[0]; + } + /** * This method creates a clone of the current object. * @return a clone of the current object diff --git a/engine/src/core/com/jme3/animation/SpatialTrack.java b/engine/src/core/com/jme3/animation/SpatialTrack.java index 54f3a76a1..4b4de7327 100644 --- a/engine/src/core/com/jme3/animation/SpatialTrack.java +++ b/engine/src/core/com/jme3/animation/SpatialTrack.java @@ -180,6 +180,13 @@ public class SpatialTrack implements Track { public Vector3f[] getTranslations() { return translations.toObjectArray(); } + + /** + * @return the length of the track + */ + public float getLength() { + return times == null ? 0 : times[times.length - 1] - times[0]; + } /** * This method creates a clone of the current object. diff --git a/engine/src/core/com/jme3/animation/Track.java b/engine/src/core/com/jme3/animation/Track.java index 1d8691b84..047f4e004 100644 --- a/engine/src/core/com/jme3/animation/Track.java +++ b/engine/src/core/com/jme3/animation/Track.java @@ -88,6 +88,11 @@ public interface Track extends Savable, Cloneable { */ Vector3f[] getTranslations(); + /** + * @return the length of the track + */ + float getLength(); + /** * This method creates a clone of the current object. * @return a clone of the current object