PDA

View Full Version : adding object animation?


scarred811
14th Mar 2007, 03:24 PM
I made a mobile to hang over a crib and I would like to make it spin. Doesn't have to be too fancy. I think the animation from The Prismo RotoBall by LumiO is just plain spinning (I could be wrong) but I'm wondering how I could take an animation and add it to my object. I know this is a basic question but I've been looking for object animation tutorials here and haven't had any luck. I tried to read some of the posts and the thread for the animation editor but they make my head spin. Are there any basic tutorials or information articles that I could look at?

Anyway, if someone could point me to the right direction so I can get my object spinning, I would greatly appreciate it.

Thanks in advance
Becka

Jasana_BugBreeder
14th Mar 2007, 05:13 PM
Object needs joints to be animated.
Objects usually have at least one joint (if none specified separately, then the joint id field in Practical node is set to 0; I saw no exclusions yet).
If it's enough for you to animate that joint - that'll move/rotate the whole object - then read the 3rd sticky thread in this forum :D Mini tutorial for adding a new animation to a object. (http://www.modthesims2.com/showthread.php?t=82437)

If it's not enough, then you need to add more joints to your object, then animate them.
AFAIK the only way to add joints is to use Milkshape and wes_h plugins (which rebuild GMDC). Or you can clone an object with enough joints and move/relink them however you want (in CRES; then you'll need to do Rebuild on Models tab in GMDC).
After your object has joints set, you adjust the ANIM resource. Right now object anims can be edited either in SimPE (with built-in editor) or in Milkshape (via export as Milkshape ASCII). Linking the animation to object is done the same way as in sticky mini-tutorial.

WesHowe
15th Mar 2007, 03:52 AM
Jasana:

I know I have not done as much with animation as you have. While I understand how joints are built, I noticed an oddity about root_rot and root_trans. If these two (or either) is defined in the CRES, then the actual joint in the GMDC seems to be redundant.

The example I will use to support this is the testbox built by CrammyBoy and posted here on MTS2 in one of the animation threads Miche used to administer. It's GMDC has no joints, but it's CRES does and it jumps, and spins and works in everything I tested (which is all the EPs except Seasons, which I have but haven't tested in yet).

So I found the animations with no gmdc joints interesting. I don't think that would work for the mobile, because part has to spin and part has to stay still. But since you have done so much good work with animations I thought I would mention it.

<* Wes *>

Echo
15th Mar 2007, 05:03 AM
Animations can operate on root_rot and root_trans, but they will affect everything below them in the hierarchy. (ie - the entire object). I'm guessing that in crammyboy's example, the whole object moves as one unit, translating and rotating, but never with different parts moving differently. Think about the difference between throwing a beach ball in the air, and throwing a pair of nunchucks in the air. The beach ball can operate entirely on one point, rotating and translating, but the nunchucks require a proper bone structure to model their movement.

In terms of rotating only about the vertical axis, there's an animation in game which serves that purpose using just root_rot (so basically it works on any animatable object). It's "o-generic-rotate360". I think there was a 180 one as well, but I'm not certain. There's also one for the car display, but that requires OFB. You can tweak the speed either in the text list itself or using the Animate Object primitive. No custom animations required. :)

scarred811
15th Mar 2007, 07:24 AM
I gave that tutorial a quick read before I posted but I felt a bit confused. I'll give it a serious reread and follow it this weekend to see if it makes more sense to me while I'm looking at SimPe. Echo, thanks for the name of the animation. I read through the list of animations but there were sooooooo many.

I'll let you know how it goes. Thanks for the help.
Becka

Jasana_BugBreeder
15th Mar 2007, 09:06 AM
I know I have not done as much with animation as you have.I hadn't done much with animation also - only simplest things :) So when we share what we know, we all may learn something new :)
I noticed an oddity about root_rot and root_trans. If these two (or either) is defined in the CRES, then the actual joint in the GMDC seems to be redundant.As Echo said - in this case, everything below joint is affected as if it'll be assigned to it. There are Maxis objects with more than 2 joints and jointless GMDCs - doors and some armoires. All of them have multiple SHPE-GMND-GMDC chains: one (via Practical) is a child of root_trans or root_rot (static part), others are children of door-rotating joints.
I have no idea why Maxis did those objects in this way - to avoid assigning joints, perhaps? it's not that complex in such objects - but it works, and ANIMs for such objects looks the same as for those which have joints in GMDC.
Mobile also can be done this way. Though I never tried to add Practical nodes - only deleted them :D - and can't tell for sure which problems may appear.

WesHowe
16th Mar 2007, 03:27 AM
Animations can operate on root_rot and root_trans, but they will affect everything below them in the hierarchy. (ie - the entire object). I'm guessing that in crammyboy's example, the whole object moves as one unit, translating and rotating, but never with different parts moving differently.


Yes it does. It is merely a cube. The animations were created using Miche's animation converter.


Think about the difference between throwing a beach ball in the air, and throwing a pair of nunchucks in the air. The beach ball can operate entirely on one point, rotating and translating, but the nunchucks require a proper bone structure to model their movement.


I think if the nunchucks stayed in a relative position where the chain didn't bend, then rotate and translate on the whole unit works. But transforming them from an inverted V to a straightline and back to the inverted V, as when thrown and caught, would take a joint (make mine a blunt) :)

I haven't been hacking at this lately, what with Seasons and Life Stories and real-life Spring weather (in this hemisphere), but adding joints and animations to objects that didn't have them already is something I have not succeeded in doing. Even trying to rename the joints the animations use (via hexedit) doesn't work, apparently because of some checksums in the animations.

<* Wes *>

Jasana_BugBreeder
16th Mar 2007, 08:14 AM
but adding joints and animations to objects that didn't have them already is something I have not succeeded in doing :( atavera said in some discussion that he added human skeleton to the garden gnome using your plugin, so I thought it'll work with other skeletons too.
I tried to clone jontless objects, add joints to CRES, and replace jointless GMDC with GMDC-with-joints (extracted from another object), but never succeeded this way - objects were crashing the game :( Cloning an object with joints, renaming and rearranging joints in CRES, Rebuild model transformations in GMDC, and then replacing functionality - did worked. I wonder why :(
Even trying to rename the joints the animations use (via hexedit) doesn't work, apparently because of some checksums in the animations. :| Maybe you have tried it in some old version of SimPE? Renaming joints in animations works perfectly, I swear :) (how could I do ferry wheel otherwise :)), for objects animations, at least, straight at the default tab. There are some tricky points with editing ANIMS, though. I've mentioned some of them in different threads, will try to summarize here :)
1. The name in the SubMesh combobox isn't important when animation is played, but Export to Milkshape ASCII will fail if this name isn't the same as the name of joint #0 in CRES. Looks like this name has checksum stored somewhere, because changing it (on Raw View tab) made the game crash. So I usually just leave it as was in original animation. If you want to export to Milkshape, it's easier to temporarily change the name in CRES - before export and after import. However, when number of joints in original animation was less than in CRES, additional joints were imported from Milkshape incorrectly - both translations and rotations, and there moved independently from their parent joints :( maybe I did something wrong back then.
2. You can rename joints and add/remove keyframes - on default (cAnimResourceConst) tab. Movements/rotations are stored in Parameter fields - 2nd value (in the row of four) is most descriptive - for movements, it's actual movement when 'Parent Shrink' is checked; for rotation, it's rotation in degrees.
3. Total animation playing time is set on RawView tab - change it to match the Duration of your keyframes. Not sure how it's measured :( but 1800 plays at about the same time as Idle(0x2c) executes.
4. Changing joint type from rotation to translation and opposite is the most tricky thing :( as I have seen so far, just changing the TransformationType on RawView tab doesn't work :( The trick is that you have to find an animation where transformation type is the one you want (and has >1 keyframes - so you can check that it's really played correctly); copy the Unknown5 value from the RawView tab for that joint, and paste to your joint. Then commit and reload resource - it'll change some fields, and joint will work as expected. Examples of such values for translation joint - 2130872072, for rotation - 2126677768.
Guess it's all, sorry for repeating myself :o

I'd like to experiment more, especially with adding joints to GMDC - having to start from an object of different category just because it has enough joints is annoying :( but I'm out of ideas. Try to play with Debug tab? Or maybe there are references to joints in other resources (like GMND) which I'm not seeing and which make me fail in 'modify CRES, import GMDC' approach?