0
\$\begingroup\$

I have a character and he is animated with the Skeleton or Bone Structure but I don't know how to animate him in my game from scratch.

I am using Java with LWJGL.

I am loading static Objects with the Obj file format but obj does not support bone animation.

\$\endgroup\$
4
  • 2
    \$\begingroup\$ Since LWJGL is just an OpenGL wrapper, you're going to have to do the implementation of skeletal animation yourself, which is fairly complex. I'd take a look online for resources on skeletal/skinned animation. \$\endgroup\$
    – Chaosed0
    Jul 27, 2016 at 19:33
  • \$\begingroup\$ I have this whole past week. I have been researching. I have found that I should use Quaternions rotation to help animate my object but I can't find anything on how to implement it in java. I have found C++ tutorials but I can really read it. I can understand a few things here and there and thats it @Chaosed0. \$\endgroup\$ Jul 27, 2016 at 20:15
  • \$\begingroup\$ @Chaosed0 This is a very Hushed Topic on the internet. No one really seems to have a clear tutorial. Only in 2D animations. \$\endgroup\$ Jul 27, 2016 at 20:22
  • \$\begingroup\$ Never learn something language specifically. Learn what quaternions are, what's the math around it and only then implement it in java. \$\endgroup\$
    – Bálint
    Jan 25, 2017 at 17:21

1 Answer 1

1
\$\begingroup\$

There are two ways that you can do this:

1. The first method is a bit different from what you might want, but it does work, and it is really simple. Using Blender, you could export all the frames of the animation, each one in a separate obj file, and then load each one using the obj loader you have made. Then, in game you could have a number, that is the number of the current animation frame, which will be incremented each frame.

Advantages: Easy to implement.

Disadvantages: Takes up a LOT of memory, doesn't give you any control over the animation, apart from the speed of the animation.

2. Export the mesh with the animated skeleton data to a COLLADA file(.dae). COLLADA is based on xml, so it should be that hard to implement a parser. Also COLLADA provides material data along side with animation and mesh data.

Advantages: Total control over animation. Doesn't take up much space.

Disadvantages: Harder to implement.

My suggestion: Use the first method for small, low detail models and the second one for more complex model and for those that you want full control over, like the player, for things like rag doll physics.

\$\endgroup\$
5
  • \$\begingroup\$ Well I am trying to figure out the Animation for my Character so when he moves it plays a set animation and so on for different actions. Right now Im working on the basics but I can't figure out how to use the COLLADA file type system I know its a whole lot harder to parse and I can parse the OBJ model but its to tidous to do the 1 method which i have done but some who it makes the game lag like crazy. And anyway I think it would be easier to learn how to use the COLLADA file system for future projects. But thank you @JasonPh \$\endgroup\$ Sep 7, 2016 at 4:10
  • \$\begingroup\$ Are you loading the obj model every frame? \$\endgroup\$
    – J22o
    Sep 7, 2016 at 11:16
  • \$\begingroup\$ I have done that method. I have made an array when the state of walking it loops through those OBJFiles but is very laggy and looks buggy. I was wondering how I would parse the DAE or COLLADA file and would i load the file as a rawmodel then texture it or IDK. I am all new to this animation thing. \$\endgroup\$ Sep 8, 2016 at 4:01
  • \$\begingroup\$ Collada is XML based. So first you need a XML parser. You can make one on your own, or you can a library from the Internet that does it for you (IDK what language you are programming in so I will leave it up to find one). Then, you will have to parse the COLLADA data. I suggest you take a look at this online tutorial, which goes through the basics, in combination with the COLLADA Specification. \$\endgroup\$
    – J22o
    Sep 10, 2016 at 15:32
  • \$\begingroup\$ But you can always also just find a library, that does it for you and that is for the language you are using, and just use that, instead of having to make the COLLADA parser on your own. \$\endgroup\$
    – J22o
    Sep 10, 2016 at 15:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .