Download

Problem animating a chest

Hello guys,

I’m kinda new to this and I wanted to animate the opening/closing of a simple chest with blueprint. I used a tutorial showing how to open/close a door and changed some things, it works, BUT no matter how I set the transform value to rotate the lid, it always rotates in the wrong direction, clipping into the chest instead of opening, as you can see on this quick test :

anim_problem.jpg

Here is my blueprint :

chest_blueprint.jpg

I’m sure it’s really dumb and easy to correct, but I don’t know how.

Thanks for the help.

Also, is there a way/tutorial about launching custom anims made in Max/Maya ? Maybe I could animate the chest in Max and export in FBX with the mesh itself ?

To play an animation from Max Maya, skin the chest to a skeleton and then export it as fbx. You can create an animation for opening and closing and play either of those in your chest blueprint.

OK I did that, but I don’t know how to use the blueprints. Do I have to use a simple blueprint or an animation blueprint ? And what do I use to trigger the animation ? I watched the tutorial about animating a character but it’s not what I need.

In the content browser, click the “Add New” button that is colored in green and click blueprint class and then actor. Double click it to open it up and click the “Add Component” button that is colored in green in the top left. Select skeletal mesh from the dropdown. In the details panel(usually at the right) look for the mesh section and set your skeletal mesh here.

The functionality and properties for your chest will be placed here, in this blueprint. For a short intro, click the tab labeled “Event Graph”. You’re faced with 3 red boxes. The first one is labeled “Event Begin Play” this will happen after the object is created and ready to go! Click on the arrow and drag out a line, then type ‘set timer’.

dd815932e52fc50aaf391890e3f58ad335c55976.png

For this small sample we will create a simple opening and closing of the chest over a recurring timer. For functionName call it “OpenCloseChest”, set it’s time to 2 and turn on looping. Now you need to create the event that the timer will call after the time runs out. Right click an empty space and create a New Custom Event and label it “OpenCloseChest”

fa04f6fbee7694a602130526a0e074233d507b37.png

Drag the skeletal mesh component from the left and dropping it into the blueprint’s event graph.

4d2d2fc80a9d86c5fe5bd03ebaf4aba30d2dc104.png

Drag out a connection from the skeletal mesh and type out “play animation” and connect this to the “OpenCloseChest” event.

e4ffb98d7ead69197a3c1af7258c548300533265.png

Whatever animation you want to play goes in the slot labeled “NewAnimToPlay”. You can have an advanced chest with many animations(open, close, locked, disappear, spawn, explode, etc) but for this one we will just have 2 animations for opening and closing and you can build off that.

Here is the simple setup for playing open and closed animations:

fes.png

Drag and drop the blueprint into the game to test the chest animations. You can do this functionality in the Animation Blueprint or in combination with the Animation Blueprint. If the animations are able to play, you can then proceed to unlocking the chest with the player and so forth. There are plenty of examples online as well.

Thanks Garner I’ll try this today.

Errr I still don’t understand, where is the animation in this ? What do I plug in “NewAnimToPlay” ? I can’t add the animation as a component.

Also what’s the relation between the timer we set and the rest of the stuff ? They are not linked.

And I don’t have a “close” anim, I just want to play the same in reverse, but this “play animation” node doesn’t seem to do that.

EDIT : nevermind I found how to put the anim in the node. Now I just need to play it in reverse to close it. Or I can export a “close” anim…