PDA

View Full Version : Tutorial: Building a new object skeleton


Echo
28th Jan 2008, 6:48 AM
Hi all,

This tutorial takes a completely static, non-animating mesh, turns it into an mesh ready for animation, and builds a useful skeleton for it. In other words, it takes this:
http://thumbs.modthesims2.com/getimage.php?file=706924
and turns it into this:
http://thumbs.modthesims2.com/getimage.php?file=706925
All ready for animating in game.

The tutorial is in the attached file "buildinganewobjectskeleton.zip" as a pdf file. A worked version of the tutorial object is also attached, for comparison.

It is fairly detailed and well illustrated, but is not for the novice or the faint of heart. At the least you should be comfortable working with animated meshes in Milkshape, and you'd be well off learning to animate existing objects in game first (since building a skeleton is pretty much no use if you can't animate it!). There's a lot of work with the CRES too, just as a warning. :)

Questions are welcome here, but please make them detailed and specific. Which part are you up to. What is not working correctly. What have you tried? And please, please attach a copy of your object so I can take a look at it! It's so much easier to tell what's going wrong if I can see the object! :D

marvine
29th Jan 2008, 11:06 AM
Echo, the thanks buttom isn't enough here :)
I didn't try the tutorial yet for lack of a project involving animated objects, but I read it carefully and it makes things perfectly clear - I'd never have guessed a lot of this.
Now "If you're feeling clever you can figure it out using Milkshape"... Well until now I wasn't aware of the other way :lol:

Daxter
29th Jan 2008, 6:56 PM
First of all: Thank you for this great tutorial. I've tried it on the chimes and it worked well.

But my flag made me cry all week. It didn't hold my coordinates for the GMDC in the right position. Every Joint went up in the air like a rocket. I tipped the coordinates from Milkshape into the coordinates from the Cres for every Joint. Everything worked well. The CRES held my coordinates and everything seemed to work well. But when I chosed Preview in the GMDC, all joints were in the wrong positions and the skeleton was unusable for an animation. SimPe don't want, that i make a custom animation. I really hope, that someone of you, will find the mistake. I already read the Custom Object Animation Tutorial and now the Custom Skeleton Tutorial.

I attached my package to this post.

Hopefully someone will find the fault in the Cres or the GMDC.

I'm desparate.

Greets from the rainy Germany

Daxter

wndy26
30th Jan 2008, 7:48 AM
This is EXACTLY what I was looking for! I am off to try it out. I didn't think to look under modding discussion for tutorials on animating though...so it took me forever to find it. Jasana actually pointed me to it! Can't wait to give it a go! Thanks Echo!

Echo
30th Jan 2008, 10:54 AM
Daxter - There's nothing technically wrong with your package as far as I can see, just that the coordinates in the cres aren't really consistent with the shape of your objects. I think I might know why though, and it's part of the reason why I didn't recommend using Milkshape unless you're already really confident doing it with SimPE.

If you have a joint node at (0,0,1), then give that node a child, and make the child a joint node at (0,0,2), then that child doesn't appear at the coordinates (0,0,2), it will end up at (0,0,3). The reason is that in a tree, each of coordinate set is not an absolute coordinate, but a relative coordinate. So the (x,y,z) translation for each node is not the distance from the point of origin, it is the distance from the position that its parent node has.

So looking at your flag, I can see that your flag's "top left" is at approx (0, 0.5, 3). The flag's "top middle" is then (-0.4, -0.7, 6) units away from the "top left", which is actually about (-0.4, -0.2, 9) in absolute space. Since the z-coordinate in TS2 is up, that means that your point is now 9 units up in the air.

Does that make sense?

You can still figure these out in Milkshape, but it requires either a bit more strategy or a bit more math. Also, remember that you have to swap around some values between Milkshape and SimPE anyway. (From memory, y=z, z=y and x=-x) :)

Marvine and Wndy - I'm just glad it's of use to someone! Thanks for the comments :D

wndy26
17th Feb 2008, 6:29 AM
I went through first and completed the flag tutorial a few times, each time my flag worked ok. Then I got to this tutorial and attempted the chimes. I think I have done most of it correctly, all my joints show up in the GMDC correctly, etc. Then I tackled the bhav's....lol - I really think those are where I am stuck at mostly. I don't get an error in my error log so I am not sure where I have my mistake.

The chimes have a much different "main" bhav than the flag had, so I read up in the common issues sticky about multi-tile objects and tried that solution, it didn't work. When I place the chime on a lot I can't delete it afterward and my animation doesn't show up.

The main on the chimes points to a "semi" main, so I imported the "semi" main into the package and adjusted it to point to a sub bhav that contains the nodes for animating the chimes. Can you take a look and let me know where i messed up with the bhav's?

By the way, the tutorial was superb and easy to follow. Once I get this part figured out I have a few more questions because I am hoping to add an animation to my sci-fi lamp.

Thanks!

Echo
17th Feb 2008, 7:44 AM
Heya wndy!

You got the tutorial almost perfect, so close in fact that I actually had to start my game 6 times before I realized which bit was missing. :) The skeleton was all set up correctly, but the vertices in the mesh weren't assigned to any of the joints. Once I finally realized that, it was a fairly easy fix. ;)

I also made a few changes to the BHAVs. You were headed in the right direction there and you had the basic principle right, but the "common issues" sticky was written for interactions rather than in main or init functions so it wasn't quite doing what you'd expect. I've attached a working version, so if you take a look hopefully it will make sense. If not, I'll write up a proper explanation.

Oh, and I did a "fix integrity". I don't think the animation had the right TGI values. :)

wndy26
17th Feb 2008, 10:28 AM
hmmm...I did assign the vertices...but I think I jumped to animating before I reloaded the GMDC with the vertices assigned...LOL....and then I forgot to reload it. Chalk it up to learning.

solfal
9th Mar 2008, 8:03 PM
Hi Echo!

Thank you so much for a new exelent tutorial! I nearly missed it.
You are a master in explaining complicated things and make them sound quite simple. :)

I have been testing this and after making the joints and asigning them I thought I would test the object before I started to make it animate. The problemm is I cant delete it. ( get the hand to apear on it ) I remade it but still the same problem. It worked before I made the tutorial changes so I guess it must somehow have to do with this, but I canīt find it.

Echo
10th Mar 2008, 1:10 AM
Heya solfal!

I'm not sure if it's the sole cause of your problems, but for some reason the joints in your GMDC are only half configured. If you open up your GMDC then flip over to the "Joints" tab, you can see that it currently says that all the joints have 0 vertices assigned.

You can fix that by clicking on each line in the joints section and pressing the 'rebuild' entry, which should fix the counts next to each of them. Hopefully that will fix it, although I haven't had a chance to test it in game. That said, I'm not quite sure how it managed to get into that state. It's not something I've ever seen before.

solfal
10th Mar 2008, 9:53 PM
Thank you Echo :). I will try that tomorrow. Sadly there was no time to test tonight.

solfal
11th Mar 2008, 9:56 PM
Great! It worked, the hand is there and I can moove it. Off to make an animation :)

Strange though as I got the same problem in both the packages I have been trying to make. I donīt know what I do wrong. I use the 3D ascii import/export. (I get an error when importing back using the unimesh plugin "no quaternions values stored).

Echo
11th Mar 2008, 11:24 PM
Ah, I'm pretty sure the ascii import doesn't handle new bones right. Regarding the quaternions error, did you do this step?

Once they're all placed, open up the "Joints" tab, and select the first joint. Click on the "comment" tab, and paste the following in there:
ImpQuatDat: 0.000000 0.000000 0.000000 1.000000 -0.150000 0.000000 -0.500000

Then click "OK". Do the same for the other two joints.

solfal
12th Mar 2008, 9:42 PM
I used the unimesh tool for the tutorial steps and I pasted that line.

It was when it came to the animation part I used the 3D ascii as I am used to that one and gets that error when trying to use the uni mesh. Should I just import the gmdc and not do the cres import when assigning joints using uni mesh?

I remade the package one more time and I think I got the turorial part right this time. It can be placed and deleted now and have the joint values. I havnīt got to the animation part yet. I donīt know what I did wrong yesterday.

Echo
12th Mar 2008, 11:20 PM
Yep, you mustn't load the cres until after you've done the joint assignments and loaded the mesh into the package. The cres import overwrites any comments you put against the joints, including the quaternion information. :) Once you import the cres, you should only use the object for creating animations, not for changing anything in the GMDC.

solfal
14th Mar 2008, 4:47 PM
Oh thank you, Thats why I never get that metod to work when assigning! :)

I cant get this thing to animate. I have been trying so many times the last two days, but it just donīt animate. I guess I am making a silly misstake. (It isnīt fix integrity as I have done that about 20 times!)
Can you see what is wrong?

Echo
16th Mar 2008, 8:50 AM
Hey :)

I haven't completely figured out why it's not animating, but I've run out of time today so I'll pass on what I've got so far. ;)

The way your interaction was written, it was going to try and run the animation on the OBJd for whichever tile you clicked on. That's how interactions normally work. However, to play an animation on an object you have to play it on the lead tile OBJd, otherwise it can't find any of the scenegraph stuff.

You can get around that easily enough by putting a line like this just before the "animate object" call:
[prim 0x0002] Expression (Stack Object ID 0x0000 := Stack Object's 0x0013 (lead tile object ID))

solfal
16th Mar 2008, 6:53 PM
Thank You Echo! I have only been animating 1 tile object so far, so this is great to know. I still doesnt animate, but it is perhaps one step closer too :)

phantomgremlock
23rd Feb 2013, 3:38 AM
Hey :)

I haven't completely figured out why it's not animating, but I've run out of time today so I'll pass on what I've got so far. ;)

The way your interaction was written, it was going to try and run the animation on the OBJd for whichever tile you clicked on. That's how interactions normally work. However, to play an animation on an object you have to play it on the lead tile OBJd, otherwise it can't find any of the scenegraph stuff.

You can get around that easily enough by putting a line like this just before the "animate object" call:
[prim 0x0002] Expression (Stack Object ID 0x0000 := Stack Object's 0x0013 (lead tile object ID))

Echo, I would love to see an up-to-date complete tutorial which combines this tutorial and your other one "Making Your First Custom Object Animation" which includes all the other details in conversation. I'm in the process of trying out your tutorial on the chime. Before I saw this tutorial, I was following the other one with the Flag-Pole and had great difficulty understanding it. The flag...in the game gave me a lot of errors but I aim to get it right yet. The only thing I could do was delete it. I thank you again for sharing your wonderful talent! :D .