Closed ahegd-dlb closed 1 month ago
as a fast solution in my case did the following workaround
internal class AModelNode(
modelInstance: ModelInstance,
autoAnimate: Boolean = true,
scaleToUnits: Float? = null,
centerOrigin: Position? = null
) : ModelNode(modelInstance, autoAnimate, scaleToUnits, centerOrigin) {
override fun onFrame(frameTimeNanos: Long) {
val isPlayingAnimations = playingAnimations.isNotEmpty()
super.onFrame(frameTimeNanos)
if (isPlayingAnimations && playingAnimations.isEmpty()) {
val animationIndex = 0 // the only animation in my case
val animator = animator
val duration = animator.getAnimationDuration(animationIndex)
val preFinalAnimationTime = duration - 0.01f // or whatever is better for your animation
animator.applyAnimation(animationIndex, preFinalAnimationTime)
animator.updateBoneMatrices()
}
}
}
I am trying to load a .glb file using Sceneview and play the animations present in it. Currently, I see that there's only a simple play/stop functionality seen in the ModelNode class which allows to play a particular animation by referring to the index/name as follows:
I would like to control the animation playback to start/stop at a specific frame. With the current setup, I see that the animation does not stop at the last frame and is reset at the end of playback. Could you please advise on how to achieve this?