3D Model reset to original position

Anything about development not directly related to libgdx, e.g. OpenGL, Android APIs etc.

3D Model reset to original position

Postby fabiitch » Sat Mar 03, 2018 10:52 pm

Hi, i got 2 questions about 3D animation in libgdx.
(ooo i forgot, Sorry for bad english !)
1) How to reset ModelInstance to original position after an animation?
I see in doc to use :
The setAnimation(String id) method will play the animation once at normal speed and then stop (freezing the animation at the last frame of the animation). To remove the animation (so the nodes are at their original transformation), call setAnimation(null).

so My code :
Code: Select all
   animationController.setAnimation(animationName, 1, new AnimationController.AnimationListener() {
            public void onEnd(AnimationController.AnimationDesc animation) {

            public void onLoop(AnimationController.AnimationDesc animation) {

i call animationController.setAnimation(null); at the end of my animation annnndddddddd
Boum !! null pointer
Code: Select all
Exception in thread "LWJGL Application" java.lang.NullPointerException
   at com.badlogic.gdx.graphics.g3d.utils.AnimationController.update(AnimationController.java:193)

when i use this line.
Code: Select all

This line dont cause directly the nullPointer, its appears during my update methode of the animation controller.
My code :
Code: Select all
if (animationController.current != null) {

I search a lot for a condition to replace my
Code: Select all
if(animationController.current != null)
(useless) but i dont find ^^

If you got my solution you are welcome.

2) My second question is about libgdx and blender.
I use blender for modeling, rigging and animations and export with fbxConv in libgdx.
I made animations for my character, but i want differents "pose" , not an animation just a single pose.
Should i made an animation with 1 frame and play it in libgdx , or it exist another clean solution?

Thaks for reading , and sorry for my english !
Posts: 14
Joined: Thu May 14, 2015 11:59 pm

Return to General Development

Who is online

Users browsing this forum: No registered users and 1 guest