Home Unreal Engine

Need help with chest animation

polycounter lvl 8
Offline / Send Message
Texelion polycounter lvl 8
Ok I tought this would be easy but it's not. Basically I submitted an asset pack with 10 chests on the marketplace, but they suggested that I made them openable and animable.

The problem is, I don't know how animation works, and after hours of watching tutorials about really specific things, I can't figure out by myself how to do it.

So here is what I have :

- a chest in two parts, the base and the lid
- a simple skeleton with two bones, "root" and "lid"
- I skinned the base to "root", and the lid to "lid", and animated the bone "lid" so the chest opens.
- I exported an FBX with the chest, skeleton and animation ( baked ) and imported that into UE4 with the correct settings. So I have an animation sequence ( and I see the animation when I open it, so it works ), the chest as a skeletal mesh, and a skeleton.

And here I'm stuck. I don't know what to do next. Do I have to use a blueprint ? An animated blueprint ? How do I trigger the animation ? What nodes should I use and where/how ?

What I would like to do is a blueprint with a trigger, when we approach the chest, it opens, and when we leave it closes.

The tutorials are either a simple presentation of the stuff, or really complicated explanation about how to move a character with several animations. And the doc only state the obvious but there is no example to show how it works.

Please halp ! 4f83441aa01d13a0f137947ced12fb1a.jpg

Replies

  • LMP
    Offline / Send Message
    LMP polycounter lvl 13
    I'm going to assume you've seen this one?
    https://youtu.be/AqYmC2wn7Cg

    But, You don't necessarily need a rig or animations. You could just have the chest as two pieces the box and the lid as separate static meshes with the lid's rotation pivot being at the origin, you can then combine them in a blueprint and have the rotation animated after it's triggered by an event.
  • LMP
    Offline / Send Message
    LMP polycounter lvl 13
    Ok, here is the basics of what you'll need until I can show you the graph necessary.
    Here are the nodes you'll need.

    Timeline node, this'll allow you to animate the lid mesh rotation value:
    https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/Timelines/Creation/index.html

    You'll need a "Add Relative Rotation" node to actually rotate the lid.

    I can show you a blueprint graph to open and close a lid when you click an object using a "flip flop" I'll post the graph as soon as I'm back on my PC.
  • Texelion
    Offline / Send Message
    Texelion polycounter lvl 8
    Ah yes I already did a blueprint like this, based on a door tutorial. But whatever I did, the lid always rotated in the same direction, and the wrong one of course. It was rotating on the X axis, but no matter if I put positive or negative values, same result :

    anim_problem.jpg

    I got some help on the unreal forum and managed to do a blueprint with the skeletal mesh and the anim I exported. Now I just need to play this anim in reverse to close the chest ( basically I did put a trigger box, when we approach the chest it opens, and when we exit the box it closes ). But there is no "reverse" in the "play anim" node, only on the timeline node. Maybe I can put my custom anim into the timeline...

    I could just export another anim to close the chest, but why use two anims if I can use one, right ?

    Thanks for your help.
  • Deathstick
    Offline / Send Message
    Deathstick polycounter lvl 7
    Another quick tip when it comes to doing mechanical animation, you don't need to have a "skeleton" or skinned rig to keep object pieces together as one animation file when exporting to UE4.

    If you're working in Max(I'm sure maya has something similar/the same), you can literally just use the link tool to link the lid to the box. The lid will follow the box if the box moves or rotates, while keeping it's own pivot point as the origin for it's own rotating and translating.

    UE4 will basically convert the links to bones on import, so you won't have to waste time skinning rigid objects. It also works with dummy objects/things like point helpers as well, and objects can be linked to things like skeletons with IK solvers for animation like the old oil rig pumps, etc.

    If it's just one object and you're doing something like a simple rotation/transform or following a path constraint then that works as well upon import.

    One last tip is say you have a scene in max where you have a ton of rigid-type transformations happening, like a physics simulation baked using MassFX or a bunch of buildings rising, cars moving, etc. If you were to just export that scene as an fbx UE4 will split all of the objects into their own seperate skeletal meshes and animation sequences, which can be a pain to re-piece back together if it's all supposed to be part of the same animation.

    A simple solution is after you're done animating all of the objects, just select them all and link them to something like a box that won't be seen/is under the ground or even a dummy helper which won't be seen at all. That dummy object will be used as the origin for moving the scene around in Unreal, and everything will still be together as one complete skeletal mesh and animation sequence. (Yay!)

    I also think the checkbox for converting dummy objects to bones should be checked when doing the actual FBX export, I'm not 100% sure if it actually effects it as I've just left it on and it seems to be working. :)



    Also, I'm not 100% sure as I haven't tried it out but I think you should be able to have a matinee used and called in a blueprint. I know at least in matinee there is support for having an animation stretched/shrunk, or reversed by right clicking the keyframe for the animation track.
  • polynesia
    I can't believe how hard it is to figure out how to do these very basic things. All the tutorials show the most complicated things ever. If you already rigged the skeleton and made the animations in a 3d software (such as blender), then all you have to do is import the fbx (make sure you tick the "Import animation" checkbox), then rename the animations to something appropriate and create a class blueprint like this:

    hhg8tbKhhg8tbK.jpg



    And then you drag the blueprint it into your level and it should work.

    You're supposed to be able to reverse the animation by adding a "Set playrate" node and entering a negative rate, but I couldn't make it work. So I just made two separate animations, one of the lid opening, and one of the lid closing.
Sign In or Register to comment.