Help with animation and rotation..

Ask questions, discuss ideas, get answers
User avatar
fo0k
Posts: 1434
Joined: Fri Oct 16, 2009 4:21 pm
Location: UK

Help with animation and rotation..

Post by fo0k »

I want to make a light, hang from a wire and slowly swing back and forth above a desk.. I'll be rendering all the frames of animation to make up an animated bik texture for the desk/floor etc

rotation bundles for this kind of purpose confuse the hell out of me.

any tips?

also (I think I would rather do this) can I just export the animation from 3dmax to use on a static object? (collisions of no consequence..)

Im guessing a direct export from max would look better anyway and easier... if possible.
really need advice on that bit..

in fact.. a very basic tutorial on creating a static object that has animation like this would be amazing... any takers?

simple max scene attached (and i think ready for a baf.. i tried exporting as baf.. then importing.. seems ok.. buuuut.. I have no idea how to get it all in game)

:geek:
Attachments
light scene.rar
(23.65 KiB) Downloaded 823 times
User avatar
Apache Thunder
Posts: 1213
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: Help with animation and rotation..

Post by Apache Thunder »

What a coincidence. I just got done animating a flag line on a boat for BFH that is somewhat similar to what you're trying (only mine does not have a light source/lightmap). There's a group of flags on a line that hangs from the mast. I just got done animating it to do the following:



I'm working on getting the boat working as a vehicle. So far the floaters are being a pain. But I still have the max file (it's in max 7 format) with the flag line rigged with a skin modifier and is a good example of how to animate something in 3DS Max. I can upload it if it is of any help. :D

EDIT:

Here's the boat the flags are now being used on:



:D
ImageImageImage
I have cameras in your head!
User avatar
fo0k
Posts: 1434
Joined: Fri Oct 16, 2009 4:21 pm
Location: UK

Re: Help with animation and rotation..

Post by fo0k »

EVERY time I think about trying this I forget about the damn flags that animate!

max file would be very useful.. please do attach! :)
User avatar
Apache Thunder
Posts: 1213
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: Help with animation and rotation..

Post by Apache Thunder »

Attached it below. I included two max files. One has it animated with an animation and the other is a clean scene with no animation. I used point objects as my bones.
Attachments
AnimatedFlags.rar
(363.7 KiB) Downloaded 834 times
ImageImageImage
I have cameras in your head!
User avatar
fo0k
Posts: 1434
Joined: Fri Oct 16, 2009 4:21 pm
Location: UK

Re: Help with animation and rotation..

Post by fo0k »

'RootBone' epic.


so before I get stuck into this... I HAVE to have a skeleton/bones in order to have something animated?

Lets say I want to make a cube float up and down.. even that needs ske files.. bones etc? I cant only use a baf?

also, if not able to do a tutorial (I appreciate that time is a factor..) could you literally explain in a paragraph what the steps are? even without explaination.. I really am at zero.

do ske files call the baf? etc! :) heheh thx
User avatar
Apache Thunder
Posts: 1213
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: Help with animation and rotation..

Post by Apache Thunder »

The only thing in the game that does not require a skeleton to animate are handweapons that are attached to a soldier. Aside from that, everything needs a skeleton for it to be animated. The animation system does not load the skeleton. This is done at the object template level.

The bones you create can be just about anything since the BF1942 scripts will convert them to bones on export (just don't get too crazy and use something ultra exotic like reactor objects as bones or something, not tested it fully. :P )

In the case of the flags, I just used point objects. The main thing to do is apply a skin modifier to your mesh and include your bones and then proceed to weight the vertexes. Once done you export the SKN file first. Make sure your skeleton is selected, then use the scripts to export the SKN file. (in the Skeleton and Skin tab). Then export your mesh (and any collison meshes if any are present). Also note that animated meshes do not require a shadow mesh. The game uses the lowest detail lod in the lod tree to make the shadow. (if your mesh is exported with more then one lod) In BFV, the engine uses the highest detail lod in the lod tree to make the shadow. Something I wished vanilla BF1942 does. I just removed the lower detail lods from my soldier meshes to solve the issue of poor soldier shadow quality like missing hand shadows)

Then export your SKE file. (leave the "Is Weapon" check box unchecked unless your animating a weapon as those don't involve animated meshes). The rest is done with coding to get the game to load your ske and skn files. Your object that uses the animated mesh must be a AnimatedBundle and the geometry template must be "AnimatedMesh". Use the ObjectTemplate.createSkeleton command to load your skeleton and the ObjectTemplate.setAnimationState command to load the animation. (use existing code as a reference)

Same goes for the geometry template. The GeometryTemplate.setSkin command loads your SKN file. The path always starts at the archives folder so the animations rfa must be in your path to the file. Unless you decided to do something odd and dump your SKN/SKE files into your standardMesh rfa instead in which case your path would have to reflect that. :D

If your animating things like balls or cups, it gets very simple. Just one bone and skin all the vertexes to that bone and do the exporting. So that would be a good start. Then animate the bone as if it was your ball/cup/other simple object and the resulting animation will animate the same way in BF1942. Just make sure you set the correct play back speed in the animation coding or you may end up with animations that play to fast. If you see that it's playing to slow even on 1.0 speed, you'll need to adjust the number of frames in your max scene/or make it animate faster in the scene. I've found that BF1942 won't allow me to set speeds higher then 1.0. You can only slow down things. So it's better to have your animation play too fast in Max since you can then fine tune the speed of it ingame via the animation state machine coding. ;)

As for making animations, I can't fully explain it right now as it would take a lot of text to do that :P , but if you've seen any of Archi's tutorials on animating weapons in BF1942 on youtube before he pulled them, then that covers the basics. Knowing how to use key frames and stuff to actually animate is the main thing. Also when exporting an animation, be sure all the bones you animated are selected. When you fill in the numbers for the time frame to export be sure to reenter them again when you "add" the animation the export list as it tries to set the frame count above the frames available in your scene. (as the scripts were originally designed to export sequences of multiple animations it seems). If you fail to do this it will export two non-existant frames and you'll end up with a >1kb baf file that won't contain the animation. ;)

Also note, if your animating something like a ball or cup and have it move a significant distance from the object's center of mass then you will end up with visibility issues with the mesh when ingame. The game only displays objects in memory if it determines that it is close enough to the camera view. It uses the bounding box of the object to determine this (this also effects when effect emitters activate). For example the luigi blimp in my mario kart mod would go invisible if I look away from it at random angles and it would disappear and reappear randomly. The center of mass of the object is invisible (it's where the root bone usually is) and thus you would have to have that area on your screen for the mesh to animate or become visible. So fix this issue simply create a Bundle object and addtemplate dummy objects to make the host object's bounding box very large. Then addtemplate your animated object to it. The dummy objects fool the game into thinking the object is larger then it actually is, and will always think it's viewable from the camera and will always render it. This trick also works on getting effects to always emit.

Example code:

Code: Select all

ObjectTemplate.create Bundle HostObject
rem ------------------------------------------
ObjectTemplate.addTemplate NullObject
ObjectTemplate.setPosition 0/0/-1024
ObjectTemplate.addTemplate NullObject
ObjectTemplate.setPosition 0/0/1024
ObjectTemplate.addTemplate NullObject
ObjectTemplate.setPosition -1024/0/0
ObjectTemplate.addTemplate NullObject
ObjectTemplate.setPosition 1024/0/0
rem ------------------------------------------
ObjectTemplate.addTemplate YourAnimatedObject

ObjectTemplate.create DummyObject NullObject

Yep, DummyObject is a valid object class in BF1942. It's an used object class and I use it for my dummy objects. :D


Hope this helps in getting you started. :D
ImageImageImage
I have cameras in your head!
User avatar
fo0k
Posts: 1434
Joined: Fri Oct 16, 2009 4:21 pm
Location: UK

Re: Help with animation and rotation..

Post by fo0k »

this is perfect, thanks man. I now have something to go on.
User avatar
fo0k
Posts: 1434
Joined: Fri Oct 16, 2009 4:21 pm
Location: UK

Re: Help with animation and rotation..

Post by fo0k »

Ok, quick Q on all this generally.. Can I add animations like this to a custom map or must this be done in the main mod files?

I seem to recall something about not being able to have custom animations in a map where the mod does not already have the files.
User avatar
Swaffy
Posts: 1715
Joined: Sun Aug 29, 2010 9:25 pm
Location: Cibolo, Texas

Re: Help with animation and rotation..

Post by Swaffy »

By my knowledge, animations can't be done map side.

*Waits for Apache Thunder to tell me I'm wrong*
(Forum Thread|Download) Swaffy'sMod v0.34 | Download link to come Soon™
User avatar
Apache Thunder
Posts: 1213
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: Help with animation and rotation..

Post by Apache Thunder »

This only applies to handweapons I believe but things like animated flags and custom animated stuff like animals and such should work fine as they don't depend on the INC files and other complicated tweak file setup that handweapons need (which never loads right for custom weapons on a mapside mod).

I think I recall being able to get the BFV flag mesh to animate via mapside modding in the standalone Dalian Plant map a long time back. Just load the animation state coding in a standard con file and make sure it's loaded in with the rest of your object coding for the map. Only handweapons and perhaps soldier animations can't work mapside.
ImageImageImage
I have cameras in your head!
Post Reply