Author Topic: Animate an avatar with jpct for Android  (Read 269 times)

Offline Noxys3

  • byte
  • *
  • Posts: 3
    • View Profile
Animate an avatar with jpct for Android
« on: June 07, 2017, 11:44:11 am »
Hello,
I am working on an Android project that looks like pokemonGo. I have an avatar that I made with Blender and MakeHuman. I use the "MakeWalk" function to animate it in Blender and now I want to display this animation in my application.
I already use JPCT_AE to display my avatar on a map but I used .OBJ format and so can't animate it. I looked for solutions on the forum and website and I found three main solutions : MD2 model, Ogre Mesh format (and Bones API) and keyframe animation as it is explained here : http://www.jpct.net/wiki/index.php/Loading_3ds_Keyframes_from_Blender.

My point is : what is the best solution for my project? I want to have a 3D avatar that can be personalized by the user by changing his textures and also animate it on the map when the user is walking.
I have memory constraints so I can't use many obj files for each pose.

I need expert's advice  :P

Thanks a lot!

Nox

Offline AGP

  • quad
  • ******
  • Posts: 1525
    • View Profile
Re: Animate an avatar with jpct for Android
« Reply #1 on: June 07, 2017, 10:57:51 pm »
Skeletal animations' main advantage is animation blending. With them, a character can, for instance, walk and talk at the same time. Much more importantly, you can transition between, say, a walk and a run seamlessly. So if you have an Ogre exporter that works for you, go for it.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11771
    • View Profile
    • http://www.jpct.net
Re: Animate an avatar with jpct for Android
« Reply #2 on: June 08, 2017, 07:53:14 am »
However, for a simple walking animation, keyframes might be sufficient as well. I guess it depends on your needs and your tools/models.

Offline Noxys3

  • byte
  • *
  • Posts: 3
    • View Profile
Re: Animate an avatar with jpct for Android
« Reply #3 on: June 08, 2017, 09:13:11 am »
Thank you for you replies.
Indeed I don't need high accuracy. I have 220 keyframes created by makewalk yet but I can keep only 8 to get a good movement.
So if I understood, I need to use 3ds format to animate my object? Could I still change my object's textures with this format?
regards,
Nox

Offline Locust

  • byte
  • *
  • Posts: 13
    • View Profile
Re: Animate an avatar with jpct for Android
« Reply #4 on: June 08, 2017, 10:54:55 am »
I basically did what you want. I did my model in MakeHuman exported it to Blender and animated it there.

Export your model from blender to the Ogre XML mesh format. Bones has some scripts appended which lets you transform these into native bones format, which can be easily loaded by the engine.
How-to: http://www.jpct.net/wiki/index.php?title=Exporting_from_Blender_to_Bones
I have 220 keyframes created by makewalk yet but I can keep only 8 to get a good movement.
I don't really get whats the point here.
Could I still change my object's textures with this format?
I guess, but I havent tried changing textures at runtime yet.

Offline AGP

  • quad
  • ******
  • Posts: 1525
    • View Profile
Re: Animate an avatar with jpct for Android
« Reply #5 on: June 08, 2017, 09:14:15 pm »
If you're going with vertex animations, your best bet is MD2. You could export all the keyframes in OBJ or 3DS, but then you'd have to manually add them to your animation in jpct. MD2 will export the whole thing in a single file.

Offline Noxys3

  • byte
  • *
  • Posts: 3
    • View Profile
Re: Animate an avatar with jpct for Android
« Reply #6 on: June 09, 2017, 02:56:49 pm »
Hi,
Thank you for your answers!

Thanks Locust for your link, i have already found it but I wanted to be sure it could help me and be the best way to do what I want to.
I said in my previous post that, at the moment, I'm doing my walking movement with a lot of frames, and I wondered if it could be a problem when exporting to Ogre XML format.

If you're going with vertex animations, your best bet is MD2. You could export all the keyframes in OBJ or 3DS, but then you'd have to manually add them to your animation in jpct. MD2 will export the whole thing in a single file.
Ok it seems to be usefull! But does MD2 only contain animation or does it also contain 3D object (like .obj and mtl)? Can I create my object3D only with MD2 or should I use .obj file and then use MD2 to animate it?

Offline AGP

  • quad
  • ******
  • Posts: 1525
    • View Profile
Re: Animate an avatar with jpct for Android
« Reply #7 on: June 09, 2017, 06:18:13 pm »
It's a format like any other. Loader.loadMD2 will give you an Object3D with its Animation instance filled.