Skip to content

Commit

Permalink
TrackEdit: add the translate() method
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Nov 17, 2024
1 parent 1743f91 commit e1db2e3
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions WesLibrary/src/main/java/jme3utilities/wes/TrackEdit.java
Original file line number Diff line number Diff line change
Expand Up @@ -2488,6 +2488,25 @@ public static TransformTrack smooth(TransformTrack oldTrack, float width,
return result;
}

/**
* Copy the translations of the specified TransformTrack, adding the
* specified offset to each translation.
*
* @param track input TransformTrack (not null, unaffected)
* @param offset the desired offset (not null, unaffected)
* @return a new array of new vectors
*/
public static Vector3f[] translate(TransformTrack track, Vector3f offset) {
Vector3f[] oldTranslations = track.getTranslations();
int count = oldTranslations.length;
Vector3f[] result = new Vector3f[count];
for (int index = 0; index < count; ++index) {
result[index] = oldTranslations[index].add(offset);
}

return result;
}

/**
* Copy a MorphTrack, truncating it at the specified time.
*
Expand Down

0 comments on commit e1db2e3

Please sign in to comment.