Skip to main content
GameDev.net gamedev.net
🔒 Locked

A return to 3d Studio 3ds files

Started by tgraupmann Apr 16, 2003 at 11:14 PM 5 replies 2.4k views
Original Post
tgraupmann
tgraupmann
With all the information at: http://lib3ds.sourceforge.net http://www.wotsit.org http://www.gametutorials.com/Tutorials/opengl/OpenGL_Pg5.htm http://www.gametutorials.com/forum/topic.asp?TOPIC_ID=5281 I can't find any information on the object track hierachy. Does anyone know how the animation tracks should be applied to a child object when the parent is an object? Applying parent to child was straightforward when the parent is a group and the child is an object because you just apply the position, rotation, and scale tracks from the group to the object. But what do you do if the parent is an object and the child is an object? Does that even make sense (how could an object be a parent)? The only thing I can think of is that by having a parent object you get the effect that the objects are linked. In that case what should be done? Find a common vertex between the two and pivot on that? Any ideas? [edited by - tgraupmann on April 16, 2003 12:20:24 AM]
*News tagenigma.com is my new domain.
tgraupmann
tgraupmann
However, the PIVOT: { 0.000000, 0.000000, 0.000000 } is always zero in all the models that I have ever seen. So what do you mean, pivot on vertex[0] which is commonly the pivot?

Tell me everything you know about this, there could be one small tiny detail that could make everything work.

I've been posting in other forums, if anyone is interested:
Allegro.cc
GameTutorials.com
CFXWeb.net
GFX Artist.com
Scifi-meshes.com
FlipCode.com
Dark Basic
CGTalk.com

[edited by - tgraupmann on April 18, 2003 12:46:46 AM]
*News tagenigma.com is my new domain.
tgraupmann
tgraupmann
Here is a better way to look at the problem:

The green sphere at the bottom is 0,0,0 for each object. All objects have a common 0,0,0 apparently?

The red spheres are each objects vertex[0] point.



The lower leg and foot are now moving together. Can you see why the upper leg and lower leg aren't pivoting together?

[edited by - tgraupmann on April 19, 2003 3:52:11 PM]
*News tagenigma.com is my new domain.
tgraupmann
tgraupmann
The solution *IS* for this model:

Read the position keys, but skip subtracting position[0] and the pivot from each vertex.

After the hierarchy is read, search for linked object hierarchies (any object that has a parent object).

Subtract position[0] and the pivot from each vertex for all objects the lack parents. Don''t do this for linked objects or groups.

Call animate model recursively, so that the upper most parent is animated first working downward from parent to child until the node being displayed is animated.

The animated routine is a little different. If a linked object is detected then operate using the following conditions:
{
- If a node lacks a parent, translate by vertex[1].
- If a node has a parent, and its parent lacks a parent, translate by vertex[last].
- If a node has a parent, and its parent has a parent, translate by vertex[1].
}

If the node is not a group, translate by position[x].

Scale by master scale.

Rotate by rotation[x].

If a linked object was detected then operate using the following conditions:
{
- If a node lacks a parent, translate by -vertex[1].
- If a node has a parent, and its parent lacks a parent, translate by -vertex[last].
- If a node has a parent, and its parent has a parent, translate by -vertex[1].
}

And that''s all the is to it.

Now the strange part is that depending on the model the logic changes. To display the DarkBasic H-Hound model, it uses the following conditions
{
- If a node lacks a parent, translate by -vertex[1].
- If a node has a parent, and its parent lacks a parent, translate by -vertex[1].
- If a node has a parent, and its parent has a parent, translate by -vertex[1].
}

The only thing that makes these models different is the number of verteces in the nodes that this logic is applied to.

Would it be correct to switch between the two implementations of this logic depending on the number of verteces in each node?

Here is some info about the two models:
H-Cyborg
======
LF_Thigh: 39 verteces
LF_Calf: 44 verteces
LF_Foot: 38 verteces

H-Hound
=======
LF_Thigh: 28 verteces
LF_Calf: 24 verteces
LF_Foot: 12 verteces

So the number of verteces is different, is this cause enough to vary the animation algorithm???
*News tagenigma.com is my new domain.
tgraupmann
tgraupmann
Great News! [url]http://www.gametutorials.com[/url] posted my 3ds animation source code. You know what this means. Beta tests are on. Test your models and send me bugs reports. Download the source here: [url]http://www.gametutorials.com/download/CodeDump/3DSAnimation2_MOD.tar.gz[/url].

-Tim Graupmann
tgraupmann@yahoo.com
[url]http://tgraupmann.hypermart.net[/url]
*News tagenigma.com is my new domain.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.