Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Rigging / Limbs?

Author
Message
Mister Fuzzy
13
Years of Service
User Offline
Joined: 27th Feb 2011
Location: XNA
Posted: 7th Aug 2011 05:21
First off, does anybody know of any good, free software packages for rigging .3ds or .x models?
Also, is there a tutorial on using limbs anywhere? I can't seem to find one, and I'd like to use them to make my character rotate his head to look at important in-game items when near them.
Thanks in advance!

"C++ is hard..."

-Donald Knuth-
_Pauli_
AGK Developer
14
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 7th Aug 2011 15:11
Quote: "good, free software packages for rigging .3ds or .x models"


Try FragMotion or Milkshape 3D. Both are great model tools when working for DarkGDK. And they released CharacterFX for free, but I'm not sure if you can do rigging with it.

Quote: "make my character rotate his head"


That wouldn't be too complicated. Just figure out which limb is your head and rotate that on the Y axis using dbRotateLimb().

Mireben
15
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 7th Aug 2011 15:26
The only problem is that, AFAIK, dbRotateLimb rotates in local coordinates, so you need to figure out local angle from the global angle to make it look at another object in world space. (I don't have a solution for that unfortunately.)
_Pauli_
AGK Developer
14
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 7th Aug 2011 16:38
To solve this problem I always have those limbs that I like to rotate to be exactly at zero angles in the model tool (the rotation of the limb itself, not the part of the mesh it belongs to).

Mireben
15
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 7th Aug 2011 19:58 Edited at: 7th Aug 2011 20:04
It's still not evident because the head angle is not the same as the real-world angle between the character and the object it's looking at, the character's facing direction needs to be taken into account, and we also need to take care not to break the character's neck by looking completely backwards, for example.

Since this is an interesting problem, I tried to write a small program to make a character always look at a target object. Here is the result. You can test it with any human model (I used one from the Dark GDK samples collection) if you know the number of the head limb.

This works in most cases, but it can produce wrong head direction with certain angles, probably because of stepping over 360 degrees which is always difficult to handle.

Mireben
15
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 7th Aug 2011 20:26
P.S. I'll see if I can come up with another method later that can handle the angles better.

To also answer your other question, I don't know a specific tutorial about limbs, but you can find out much by experimenting with the limb commands. If you have a model that you didn't make yourself and don't know the numbering of its limbs, you can make a checklist and display the names of the limbs on the screen, for example like this:

Mireben
15
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 7th Aug 2011 22:41
This code works better for turning the head in the target direction. (It's the calculation part, the rest was only the testing framework, so I don't repeat the whole program. Limiting the rotation to +/- limitAngle will also be the same.)

Mister Fuzzy
13
Years of Service
User Offline
Joined: 27th Feb 2011
Location: XNA
Posted: 8th Aug 2011 21:12
Whoa! I leave for a day and I get a buttload of replies! Thanks, _Pauli_ and Mireben!

For rigging, I'll probably use anim8or - It can only export .3ds, but I'll take what I can get: It's simple, efficient, open source, and gets the job done.

As for rotating the hcaracter's head, I noticed that you based head mobement on variables based on angles & math, math, math... In games I've made before, I always use an invisible object to look at an important in-range object, and if the angle of the object is within "Natural" range, then the head moves to its angle ( with interpolation to make it look more natural ). I'd post some code showing this, but I REALLY need to work on my app's controls more. 3rd person 3D is harder than it looks!

Mireben
15
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 8th Aug 2011 23:15
I searched the forum a bit about this topic and came across the invisible object idea, but I thought that it won't completely solve the problem, because the angles you get from the dummy object will be "absolute" values, while for the head you need an angle relative to the body mesh. But if you have a simple solution with this method, then do post the code, I'm interested too.
Mireben
15
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 9th Aug 2011 11:06
A few more thoughts. While writing this test program, I think I stumbled upon a bug, which may be good to know for you as well:

http://forum.thegamecreators.com/?m=forum_view&t=187831&b=15

This is why I had to use the modelDir variable and dbRotateObject instead of just turning it left or right and querying the current angle. I thought you might wonder why I did it that way.

While searching the forums, I also found a function which points a limb at an arbitrary point in space, but it's written in Dark Basic so it would need porting to Dark GDK and it contains much heavier math than my solution. I may try to port it nevertheless because it would be very useful if it works, but for this task simpler calculations are enough. The math I used here is actually not difficult, if you make a drawing on a piece of paper about the angles, I think it becomes clear. But again, if you have an alternative solution which works, I'm interested in that too.

Login to post a reply

Server time is: 2024-05-18 10:26:11
Your offset time is: 2024-05-18 10:26:11