[{"data":1,"prerenderedAt":1247},["ShallowReactive",2],{"data":3,"\u002Fwiki\u002Fguides\u002Fbedrock-modeling":118},[4,9,14,19,24,29,34,39,44,49,54,59,64,68,73,78,83,88,93,98,103,108,113],{"title":5,"path":6,"description":7,"id":8},"FAQ","\u002Fblockbench\u002Ffaq","Frequently Asked Questions about Blockbench","content\u002Fblockbench\u002Ffaq.md",{"title":10,"path":11,"description":12,"id":13},"Formats","\u002Fblockbench\u002Fformats","formats","content\u002Fblockbench\u002Fformats.md",{"title":15,"path":16,"description":17,"id":18},"Legacy Versions","\u002Fblockbench\u002Flegacy-versions","Blockbench version history and changelogs prior to switching to Github Releases","content\u002Fblockbench\u002Flegacy-versions.md",{"title":20,"path":21,"description":22,"id":23},"Localization","\u002Fblockbench\u002Flocalization","How to contribute to Blockbench languages","content\u002Fblockbench\u002Flocalization.md",{"title":25,"path":26,"description":27,"id":28},"Logos and Brand Assets","\u002Fblockbench\u002Flogos","Frequently Asked Questions about the Blockbench app","content\u002Fblockbench\u002Flogos.md",{"title":30,"path":31,"description":32,"id":33},"Custom Themes","\u002Fblockbench\u002Fthemes","Themes allow you to change the visual appearance of Blockbench. You can drag and drop .bbtheme files into Blockbench to load them.","content\u002Fblockbench\u002Fthemes.md",{"title":35,"path":36,"description":37,"id":38},"The .bbmodel format","\u002Fdocs\u002Fbbmodel","An overview of the .bbmodel file format","content\u002Fdocs\u002Fbbmodel.md",{"title":40,"path":41,"description":42,"id":43},"Blockbench","\u002Fdocs\u002Fblockbench","The Blockbench object provides useful variables and methods to interact with general functionality of Blockbench.","content\u002Fdocs\u002Fblockbench.md",{"title":45,"path":46,"description":47,"id":48},"Upgrading Plugins to 5.0","\u002Fdocs\u002Fplugin-upgrade-to-5.0","An overview of breaking changes in the plugin API in 5.0","content\u002Fdocs\u002Fplugin-upgrade-to-5.0.md",{"title":50,"path":51,"description":52,"id":53},"Creating a Plugin","\u002Fdocs\u002Fplugin","This article will go over the basic steps needed to create your first plugin.","content\u002Fdocs\u002Fplugin.md",{"title":55,"path":56,"description":57,"id":58},"Properties","\u002Fdocs\u002Fproperty","Properties are used to dynamically assign properties to existing classes that are undo-relevant.\nThe advantages of using properties include:","content\u002Fdocs\u002Fproperty.md",{"title":60,"path":61,"description":62,"id":63},"Interface","\u002Fdocs\u002Fui","","content\u002Fdocs\u002Fui.md",{"title":65,"path":66,"description":62,"id":67},"Undo","\u002Fdocs\u002Fundo","content\u002Fdocs\u002Fundo.md",{"title":69,"path":70,"description":71,"id":72},"Web App URL Parameters","\u002Fdocs\u002Furl-parameters","How to provide integration with the Blockbench web app using URL parameters","content\u002Fdocs\u002Furl-parameters.md",{"title":74,"path":75,"description":76,"id":77},"Utils","\u002Fdocs\u002Futility","Blockbench comes with a bunch of custom utility functions to make the life of developers easier.","content\u002Fdocs\u002Futility.md",{"title":79,"path":80,"description":81,"id":82},"Animation Expressions","\u002Fguides\u002Fanimation-expressions","Expressions in animations can be used to create dynamic animations based on math expressions, or to create systems where variables can be used to modify the transformation or state of the model, such as facial expressions","content\u002Fguides\u002Fanimation-expressions.md",{"title":84,"path":85,"description":86,"id":87},"Bedrock Modeling and Animation","\u002Fguides\u002Fbedrock-modeling","Learn how to create entity models and animations for Minecraft Bedrock Edition","content\u002Fguides\u002Fbedrock-modeling.md",{"title":89,"path":90,"description":91,"id":92},"Blockbench Overview & Tips","\u002Fguides\u002Fblockbench-overview-tips","The fundamentals of Blockbench and how to use it efficiently","content\u002Fguides\u002Fblockbench-overview-tips.md",{"title":94,"path":95,"description":96,"id":97},"Emissive Textures in Renders","\u002Fguides\u002Femissive-textures-renders","How to create elegant emissive textures in renders","content\u002Fguides\u002Femissive-textures-renders.md",{"title":99,"path":100,"description":101,"id":102},"3D Export","\u002Fguides\u002Fexport-formats","An overview of the different export formats and how to transfer your model into other programs","content\u002Fguides\u002Fexport-formats.md",{"title":104,"path":105,"description":106,"id":107},"Particles and Sounds in MC Bedrock","\u002Fguides\u002Fminecraft-particles-sounds","How to add particles and sounds effects to animations for Minecraft Bedrock Edition","content\u002Fguides\u002Fminecraft-particles-sounds.md",{"title":109,"path":110,"description":111,"id":112},"Minecraft Style Guide","\u002Fguides\u002Fminecraft-style-guide","Tips for creating art in the Minecraft style","content\u002Fguides\u002Fminecraft-style-guide.md",{"title":114,"path":115,"description":116,"id":117},"Rendering Models","\u002Fguides\u002Fmodel-rendering","Learn how to create renders of your Blockbench models","content\u002Fguides\u002Fmodel-rendering.md",{"id":87,"title":84,"body":119,"description":86,"extension":1239,"meta":1240,"navigation":1243,"path":85,"seo":1244,"stem":1245,"__hash__":1246},{"type":120,"value":121,"toc":1221},"minimark",[122,127,142,151,154,168,173,176,183,188,191,198,202,210,217,228,231,235,238,244,247,258,261,265,272,278,281,284,287,294,298,302,305,311,315,318,322,325,328,342,346,349,353,361,368,374,465,468,486,512,515,545,548,552,564,570,584,587,590,593,610,616,700,703,718,721,725,728,735,746,792,798,804,902,909,1055,1058,1135,1138,1145,1152,1155,1217],[123,124,126],"h1",{"id":125},"entity-modeling-and-animation","Entity Modeling and Animation",[128,129,130],"p",{},[131,132,133,134,141],"em",{},"This article is part of the Minecraft Entity Introduction tutorial series from the Minecraft Creator Portal and can also be found on ",[135,136,140],"a",{"href":137,"rel":138},"https:\u002F\u002Fdocs.microsoft.com\u002Fen-us\u002Fminecraft\u002Fcreator\u002Fdocuments\u002Fentitymodelingandanimation",[139],"nofollow","Microsoft Docs",".",[128,143,144,145,150],{},"In this guide, we'll go through the basics of creating a model and creating animations for Minecraft: Bedrock Edition. As an example, we'll model and animate a small robot, which was started in the ",[135,146,149],{"href":147,"rel":148},"https:\u002F\u002Fdocs.microsoft.com\u002Fen-us\u002Fminecraft\u002Fcreator\u002Fdocuments\u002FIntroductionToAddEntity",[139],"Introduction to Add Entity"," article.",[128,152,153],{},"In this tutorial you will learn the following:",[155,156,157,165],"ul",{},[158,159,160,161,141],"li",{},"How to create a model for an entity using ",[135,162,40],{"href":163,"rel":164},"https:\u002F\u002Fblockbench.net\u002F",[139],[158,166,167],{},"How to apply textures and animations to a model.",[169,170,172],"h3",{"id":171},"requirements","Requirements",[128,174,175],{},"It’s recommended that the following be completed before beginning this tutorial.",[155,177,178],{},[158,179,180],{},[135,181,149],{"href":147,"rel":182},[139],[184,185,187],"h2",{"id":186},"model","Model",[128,189,190],{},"Models in Minecraft use a specific format that uses JSON to define the shape. Each model uses a texture that can be assigned through render controllers.",[128,192,193,194,197],{},"To create the model and texture, we're going to use ",[135,195,40],{"href":163,"rel":196},[139],", a 3D modeling program that can create models for the Bedrock Edition of Minecraft.",[169,199,201],{"id":200},"setting-up-the-model","Setting Up the Model",[128,203,204,205,209],{},"When you first open Blockbench, you'll see a list of available model formats. Select ",[206,207,208],"strong",{},"Bedrock Model",". You'll see a dialog about the basic settings for the project.",[128,211,212],{},[213,214],"img",{"alt":215,"src":216},"Project settings for Bedrock Edition models in Blockbench","https:\u002F\u002Fdocs.microsoft.com\u002Fen-us\u002Fminecraft\u002Fcreator\u002Fdocuments\u002FMedia\u002FEntityModeling\u002Fblockbenchnewproject.png",[128,218,219,220,223,224,141],{},"The important part is ",[206,221,222],{},"Mob Geometry Name",". Here, we'll enter a unique name for the model. The best practice is to use snake_case — so only lower case letters, numbers and underscores as well as dots. Spaces and other special characters aren't supported. For our model, we'll just input ",[225,226,227],"code",{},"robot",[128,229,230],{},"We can leave the field for the file name empty for now as we'll later define it when we export the model. The Box UV setting and the texture size can also be left at default because we'll change them later. The confirm button will save these settings.",[169,232,234],{"id":233},"bone-structure","Bone Structure",[128,236,237],{},"The first thing to consider when making a model is the bone structure. Bones are the part of the model that can be animated, and they can be arranged in an arbitrarily deep hierarchy. Each bone itself is invisible but can contain cubes that will shape the model.",[128,239,240],{},[213,241],{"alt":242,"src":243},"Bone listing in Blockbench","https:\u002F\u002Fdocs.microsoft.com\u002Fen-us\u002Fminecraft\u002Fcreator\u002Fdocuments\u002FMedia\u002FEntityModeling\u002Fbonestructure.png",[128,245,246],{},"A good practice is to use a root bone for each model and put everything else inside it. This means that you'll later be able to animate the entire model at once, as well as specific parts of it. Create a new group in Blockbench. “Groups” and “Bones” are essentially the same in this context.",[128,248,249,250,253,254,257],{},"You can right-click the group or press ",[206,251,252],{},"F2"," to rename it. The name for a bone should be ",[225,255,256],{},"snake_case"," (so only including lower case letters, numbers, and underscores). Each bone name has to be unique for future reference through animations.",[128,259,260],{},"While we build up the model in the following steps, make sure the structure is set up correctly. You can drag around groups to change the order or drop them into other groups. This screenshot shows the correct bone structure of the finished model.",[169,262,264],{"id":263},"shape","Shape",[128,266,267,268,271],{},"You can now start to create the shape of the model. Create new cubes and use the move, resize, and rotation tools to adjust it. A trick to add cubes faster is to select an already positioned cube and press ",[206,269,270],{},"Ctrl + D"," (duplicate) to get a copy.",[128,273,274],{},[213,275],{"alt":276,"src":277},"Textureless shape of a robot in Blockbench","https:\u002F\u002Fdocs.microsoft.com\u002Fen-us\u002Fminecraft\u002Fcreator\u002Fdocuments\u002FMedia\u002FEntityModeling\u002Fshape.png",[128,279,280],{},"You can move cubes more precisely by holding either shift, control, or both at the same time. Depending on the modeling style, it can make sense to completely stick to the grid or only move the cubes in half or quarter increments.",[128,282,283],{},"Bedrock Edition models use Box UV mapping by default. That means that the texture mapping will only use full numbers and will round down to a smaller number if necessary. To avoid stretched or invisible faces, make sure the size of cubes sticks to full numbers.",[128,285,286],{},"If you're working on symmetrical parts like limbs, create them on the right-hand side first and mirror them to the left later. You can either mirror them before or after creating the texture depending on whether you want the same texture on both sides.",[128,288,289,290,293],{},"When you're creating bones for moving parts of the model, always think about which point the part should rotate around. Select a bone and press ",[206,291,292],{},"P"," to get the Pivot tool. This tool allows you to move the pivot point of the bone. You can also use this tool on cubes if you want to rotate those around a specific point.",[184,295,297],{"id":296},"texturing","Texturing",[169,299,301],{"id":300},"templates","Templates",[128,303,304],{},"Once the shape of the model is done, you can create a texture template. The template is a texture that has a unique space for every cube and every face of the model. You can also UV map cubes manually, but creating a template does the work for you and finds the most space-efficient layout. Remember that Minecraft doesn’t like high-resolution images.",[128,306,307,308,310],{},"When creating a texture, enter ",[225,309,227],{}," as the texture name and check the Template option. In the template dialog, select your resolution. 16x is the default resolution of Minecraft, but you can go higher if you want.",[169,312,314],{"id":313},"base-color","Base Color",[128,316,317],{},"Once the template is created, you can move to the Paint tab in Blockbench. This will reveal all the tools you have to modify the texture. Select the Paint Bucket tool and set the fill mode next to the tool to Cube. Select a color in the color panel on the right side. Now you can go over your cubes and color them in individual base colors.",[169,319,321],{"id":320},"details","Details",[128,323,324],{},"You can now start to work on the texture. If you're more comfortable with texturing in your image editing program, you can now save the texture by clicking on the save icon next to the texture. Then, you can open it in your image editor. Any changes will appear in Blockbench as soon as you save the texture. But, if you prefer to work directly on the model, you can use the built-in paint tools in Blockbench.",[128,326,327],{},"There are a few tricks to use the paintbrush in Blockbench more efficiently:",[155,329,330,333,336,339],{},[158,331,332],{},"To paint larger areas, you can increase the brush size.",[158,334,335],{},"You can paint directly in the 3D preview, or you can paint it in the UV editor on the left side.",[158,337,338],{},"If you want to create a straight line, click on the beginning of the line, then hold shift on the end of the line.",[158,340,341],{},"To make sure you don’t miss covered spots that might be revealed through animations, you can hide cubes. Just click on the eye icon in the outliner.",[184,343,345],{"id":344},"animations","Animations",[128,347,348],{},"Animations can animate the shape of your model, but they can also play sounds and particle effects. In the following section, we'll take a look at how to add an animation to your entity, how to create your own animation in Blockbench, and finally, how to use animation controllers.",[169,350,352],{"id":351},"using-default-animations","Using Default Animations",[128,354,355,356,141],{},"The vanilla resource pack contains generic animations that you can reference in your own pack without actually copying the files. These animations can be a good starting point for vanilla-like entities, but of course, custom animations are a lot more powerful. You can find all vanilla animations in the vanilla resource pack ",[135,357,360],{"href":358,"rel":359},"https:\u002F\u002Faka.ms\u002Fresourcepacktemplate",[139],"here",[128,362,363,364,367],{},"In this example, we'll be using the ",[131,365,366],{},"look at"," animation. This animation will rotate the “head” bone. That’s why it's important that the head of the model uses the exact same name.",[128,369,370,371,373],{},"Also, the entity will need a ",[131,372,366],{}," component in its behavior file. These are the looking components from the cow. You can play around with the numbers if you like.",[375,376,380],"pre",{"className":377,"code":378,"language":379,"meta":62,"style":62},"language-json shiki shiki-themes github-light github-dark","            \"minecraft:behavior.look_at_player\": {\n                \"priority\": 7,\n                \"look_distance\": 6,\n                \"probability\": 0.02\n            },\n            \"minecraft:behavior.random_look_around\": {\n                \"priority\": 9\n            }\n","json",[225,381,382,395,411,424,435,441,449,459],{"__ignoreMap":62},[383,384,387,391],"span",{"class":385,"line":386},"line",1,[383,388,390],{"class":389},"sZZnC","            \"minecraft:behavior.look_at_player\"",[383,392,394],{"class":393},"sVt8B",": {\n",[383,396,398,402,405,408],{"class":385,"line":397},2,[383,399,401],{"class":400},"sj4cs","                \"priority\"",[383,403,404],{"class":393},": ",[383,406,407],{"class":400},"7",[383,409,410],{"class":393},",\n",[383,412,414,417,419,422],{"class":385,"line":413},3,[383,415,416],{"class":400},"                \"look_distance\"",[383,418,404],{"class":393},[383,420,421],{"class":400},"6",[383,423,410],{"class":393},[383,425,427,430,432],{"class":385,"line":426},4,[383,428,429],{"class":400},"                \"probability\"",[383,431,404],{"class":393},[383,433,434],{"class":400},"0.02\n",[383,436,438],{"class":385,"line":437},5,[383,439,440],{"class":393},"            },\n",[383,442,444,447],{"class":385,"line":443},6,[383,445,446],{"class":389},"            \"minecraft:behavior.random_look_around\"",[383,448,394],{"class":393},[383,450,452,454,456],{"class":385,"line":451},7,[383,453,401],{"class":400},[383,455,404],{"class":393},[383,457,458],{"class":400},"9\n",[383,460,462],{"class":385,"line":461},8,[383,463,464],{"class":393},"            }\n",[128,466,467],{},"Now that the behavior is set up, we'll head to the client entity file. Make sure that the format version for this file is set to 1.10.0 or higher for this to work.",[128,469,470,471,474,475,478,479,474,482,485],{},"First, let’s link the animation. This is done in the animations section in the description tag of the entity. The second part here (",[225,472,473],{},"animation.common.look_at_target",") is the ",[206,476,477],{},"global identifier"," of the animation. This name is defined in the animation file and is valid anywhere in this pack or any other pack. The first part (",[225,480,481],{},"look_at_target",[206,483,484],{},"short name",". This is how we reference the animation within the entity file, and it's only valid in the scope of this entity.",[375,487,489],{"className":377,"code":488,"language":379,"meta":62,"style":62},"            \"animations\": {\n                \"look_at_target\": \"animation.common.look_at_target\"\n            }\n",[225,490,491,498,508],{"__ignoreMap":62},[383,492,493,496],{"class":385,"line":386},[383,494,495],{"class":389},"            \"animations\"",[383,497,394],{"class":393},[383,499,500,503,505],{"class":385,"line":397},[383,501,502],{"class":400},"                \"look_at_target\"",[383,504,404],{"class":393},[383,506,507],{"class":389},"\"animation.common.look_at_target\"\n",[383,509,510],{"class":385,"line":413},[383,511,464],{"class":393},[128,513,514],{},"Now, we need to play the animation. For simple animations that are always active while the entity exists, this is as simple as listing the short name in the scripts\u002Fanimate array in the client entity file.",[375,516,518],{"className":377,"code":517,"language":379,"meta":62,"style":62},"            \"scripts\": {\n                \"animate\": [\"look_at_target\"]\n            }\n",[225,519,520,527,541],{"__ignoreMap":62},[383,521,522,525],{"class":385,"line":386},[383,523,524],{"class":389},"            \"scripts\"",[383,526,394],{"class":393},[383,528,529,532,535,538],{"class":385,"line":397},[383,530,531],{"class":400},"                \"animate\"",[383,533,534],{"class":393},": [",[383,536,537],{"class":389},"\"look_at_target\"",[383,539,540],{"class":393},"]\n",[383,542,543],{"class":385,"line":413},[383,544,464],{"class":393},[128,546,547],{},"If you now test the robot in-game, you'll see that it will turn its head and look around.",[169,549,551],{"id":550},"creating-an-animation","Creating an Animation",[128,553,554,555,559,560,563],{},"In the ",[135,556,558],{"href":147,"rel":557},[139],"add entity guide",", we created a small driving animation for the robot. Let’s now create an animation that plays when the robot loses the ground under its feet (wheel). Before creating an animation, always check if there's a way to trigger it. We can easily trigger a lose-balance animation for this because we can just use the MoLang query ",[225,561,562],{},"query.is_on_ground"," to test when the robot no longer touches the ground.",[128,565,566],{},[213,567],{"alt":568,"src":569},"Animation controls in Blockbench","https:\u002F\u002Fdocs.microsoft.com\u002Fen-us\u002Fminecraft\u002Fcreator\u002Fdocuments\u002FMedia\u002FEntityModeling\u002Fanimation.png",[128,571,572,573,576,577,579,580,583],{},"Simple animations can be created in the text editor, but for more complex, keyframe-based animations, Blockbench makes this easier. Open the model and switch to the ",[206,574,575],{},"Animate"," tab in the top-right corner. Create a new animation in the ",[206,578,345],{}," panel on the left side and name it ",[225,581,582],{},"animation.robot.sway",". You can also choose a longer name or include a namespace to ensure compatibility with other addons. But please keep in mind that animation identifiers only support snake_case, strings and dots, but not colons or dashes.",[128,585,586],{},"Once you have set up the animation, you can start animating. Select the root bone of your entity. Move your time cursor in the timeline to 0 seconds and click the plus icon next to Rotation. This will create a new keyframe at the new position. Now move the cursor to about 0.2 seconds. Select the rotate tool and rotate the whole robot to the left slightly. This will automatically generate a new keyframe. On the left side of the screen, you can see the values. Rotate it to about 10 degrees.",[128,588,589],{},"Now move forward in time to about half a second and rotate the root bone to the other side. Finally, move to 1 second and rotate it back to 0.",[128,591,592],{},"If you now move the cursor to the beginning and press play, you'll see a short sway animation. Now that you know how to animate, you can refine the animation and, for example, let the antenna swing a bit.",[128,594,595,596,599,600,603,604,606,607,141],{},"Finally, press ",[206,597,598],{},"Ctrl + S"," to save the model and ",[206,601,602],{},"animation",". Save the animation in the ",[225,605,344],{}," folder of the resource pack as ",[225,608,609],{},"robot.animation.json",[128,611,612,613,615],{},"Now reference and play the animation in the client entity file as we've done with the ",[131,614,366],{}," animation. But now we'll only play the sway animation under the condition that the robot isn't on ground. This will look something like this:",[375,617,619],{"className":377,"code":618,"language":379,"meta":62,"style":62},"            \"animations\": {\n                \"look_at_target\": \"animation.common.look_at_target\",\n                \"sway\": \"animation.robot.sway\"\n            },\n            \"scripts\": {\n                \"animate\": [\n                    \"look_at_target\",\n                    {\"sway\":\"!query.is_on_ground\"}\n                ]\n            }\n",[225,620,621,627,638,648,652,658,665,672,689,695],{"__ignoreMap":62},[383,622,623,625],{"class":385,"line":386},[383,624,495],{"class":389},[383,626,394],{"class":393},[383,628,629,631,633,636],{"class":385,"line":397},[383,630,502],{"class":400},[383,632,404],{"class":393},[383,634,635],{"class":389},"\"animation.common.look_at_target\"",[383,637,410],{"class":393},[383,639,640,643,645],{"class":385,"line":413},[383,641,642],{"class":400},"                \"sway\"",[383,644,404],{"class":393},[383,646,647],{"class":389},"\"animation.robot.sway\"\n",[383,649,650],{"class":385,"line":426},[383,651,440],{"class":393},[383,653,654,656],{"class":385,"line":437},[383,655,524],{"class":389},[383,657,394],{"class":393},[383,659,660,662],{"class":385,"line":443},[383,661,531],{"class":400},[383,663,664],{"class":393},": [\n",[383,666,667,670],{"class":385,"line":451},[383,668,669],{"class":389},"                    \"look_at_target\"",[383,671,410],{"class":393},[383,673,674,677,680,683,686],{"class":385,"line":461},[383,675,676],{"class":393},"                    {",[383,678,679],{"class":400},"\"sway\"",[383,681,682],{"class":393},":",[383,684,685],{"class":389},"\"!query.is_on_ground\"",[383,687,688],{"class":393},"}\n",[383,690,692],{"class":385,"line":691},9,[383,693,694],{"class":393},"                ]\n",[383,696,698],{"class":385,"line":697},10,[383,699,464],{"class":393},[128,701,702],{},"If you now spawn a robot and push it down an edge, the animation will play. But it will only play once.",[128,704,705,706,709,710,713,714,717],{},"The reason for that is the fact that the query in the scripts section is only a blend value for the animation. It defines “how much” the animation plays, not when it plays and when it doesn't. That’s why the animation will start playing once ",[225,707,708],{},"!query.is_on_ground"," is ",[225,711,712],{},"true\u002F1",", but it will never stop playing. It will just fade out once the value is ",[225,715,716],{},"false\u002F0"," again, and the next time it will fade into the animation again. It won’t play from the start again.",[128,719,720],{},"We can use this behavior quite well for static or looping animations that have no beginning and no end. But if we want to start the animation every time the query changes, we need a different approach. This is where animation controllers come in.",[169,722,724],{"id":723},"animation-controllers","Animation Controllers",[128,726,727],{},"Animation controllers work with states. An animation controller can have an unlimited number of states. Only one of these states is active at a time. The controller can transition to other states through MoLang expressions. Each state can play a distinct set of animations, sounds, and particle effects.",[128,729,730,731,734],{},"Each time the entity is loaded by the client, for example, when joining a world, the animation controller starts in an initial state. This state is called ",[225,732,733],{},"default"," by default.",[128,736,737,738,741,742,745],{},"To set up the animation controller, create a new folder in the resource pack called ",[225,739,740],{},"animation_controllers",". Inside the folder, create a new file called ",[225,743,744],{},"robot.animation_controllers.json",". Create an animation controller like this:",[375,747,749],{"className":377,"code":748,"language":379,"meta":62,"style":62},"{\n    \"format_version\": \"1.10.0\",\n    \"animation_controllers\": {\n        \"controller.animation.robot.ground\": {}\n    }\n}\n",[225,750,751,756,768,775,783,788],{"__ignoreMap":62},[383,752,753],{"class":385,"line":386},[383,754,755],{"class":393},"{\n",[383,757,758,761,763,766],{"class":385,"line":397},[383,759,760],{"class":400},"    \"format_version\"",[383,762,404],{"class":393},[383,764,765],{"class":389},"\"1.10.0\"",[383,767,410],{"class":393},[383,769,770,773],{"class":385,"line":413},[383,771,772],{"class":400},"    \"animation_controllers\"",[383,774,394],{"class":393},[383,776,777,780],{"class":385,"line":426},[383,778,779],{"class":400},"        \"controller.animation.robot.ground\"",[383,781,782],{"class":393},": {}\n",[383,784,785],{"class":385,"line":437},[383,786,787],{"class":393},"    }\n",[383,789,790],{"class":385,"line":443},[383,791,688],{"class":393},[128,793,794,795,797],{},"Now, we need to create an initial state. This state is called ",[225,796,733],{}," by default. The animation controller will always start in this state when the entity is loaded. For example, after rejoining the world.",[128,799,800,801,803],{},"The only job of this state is to transition to the swaying state once the entity is no longer on the ground. We'll use a transition for this. The controller will switch to that state as soon as the ",[225,802,562],{}," query is no longer true.",[375,805,807],{"className":377,"code":806,"language":379,"meta":62,"style":62},"{\n    \"format_version\": \"1.10.0\",\n    \"animation_controllers\": {\n        \"controller.animation.robot.ground\": {\n            \"states\": {\n                \"default\": {\n                    \"transitions\":[\n                        {\"swaying\": \"!query.is_on_ground\"}\n                    ]\n                }\n            }\n        }\n    }\n}\n",[225,808,809,813,823,829,835,842,849,857,871,876,881,886,892,897],{"__ignoreMap":62},[383,810,811],{"class":385,"line":386},[383,812,755],{"class":393},[383,814,815,817,819,821],{"class":385,"line":397},[383,816,760],{"class":400},[383,818,404],{"class":393},[383,820,765],{"class":389},[383,822,410],{"class":393},[383,824,825,827],{"class":385,"line":413},[383,826,772],{"class":400},[383,828,394],{"class":393},[383,830,831,833],{"class":385,"line":426},[383,832,779],{"class":400},[383,834,394],{"class":393},[383,836,837,840],{"class":385,"line":437},[383,838,839],{"class":400},"            \"states\"",[383,841,394],{"class":393},[383,843,844,847],{"class":385,"line":443},[383,845,846],{"class":400},"                \"default\"",[383,848,394],{"class":393},[383,850,851,854],{"class":385,"line":451},[383,852,853],{"class":400},"                    \"transitions\"",[383,855,856],{"class":393},":[\n",[383,858,859,862,865,867,869],{"class":385,"line":461},[383,860,861],{"class":393},"                        {",[383,863,864],{"class":400},"\"swaying\"",[383,866,404],{"class":393},[383,868,685],{"class":389},[383,870,688],{"class":393},[383,872,873],{"class":385,"line":691},[383,874,875],{"class":393},"                    ]\n",[383,877,878],{"class":385,"line":697},[383,879,880],{"class":393},"                }\n",[383,882,884],{"class":385,"line":883},11,[383,885,464],{"class":393},[383,887,889],{"class":385,"line":888},12,[383,890,891],{"class":393},"        }\n",[383,893,895],{"class":385,"line":894},13,[383,896,787],{"class":393},[383,898,900],{"class":385,"line":899},14,[383,901,688],{"class":393},[128,903,904,905,908],{},"Now, we’ll add the swaying state. This state will play the swaying animation and after that, reset the controller by going back to the default state. We can use the query ",[225,906,907],{},"query.all_animations_finished"," to only transition after the animation has played. This query will only return true once all animations of the current state have finished playing. In addition, we will test if the entity is on the ground again.",[375,910,912],{"className":377,"code":911,"language":379,"meta":62,"style":62},"{\n    \"format_version\": \"1.10.0\",\n    \"animation_controllers\": {\n        \"controller.animation.robot.ground\": {\n            \"states\": {\n                \"default\": {\n                    \"transitions\":[\n                        {\"swaying\": \"!query.is_on_ground\"}\n                    ]\n                },\n                \"swaying\": {\n                    \"animations\":[\n                        \"sway\"\n                    ],\n                    \"transitions\":[\n                        {\"default\": \"query.all_animations_finished && query.is_on_ground\"}\n                    ]\n                }\n            }\n        }\n    }\n}\n",[225,913,914,918,928,934,940,946,952,958,970,974,979,986,993,998,1003,1010,1025,1030,1035,1040,1045,1050],{"__ignoreMap":62},[383,915,916],{"class":385,"line":386},[383,917,755],{"class":393},[383,919,920,922,924,926],{"class":385,"line":397},[383,921,760],{"class":400},[383,923,404],{"class":393},[383,925,765],{"class":389},[383,927,410],{"class":393},[383,929,930,932],{"class":385,"line":413},[383,931,772],{"class":400},[383,933,394],{"class":393},[383,935,936,938],{"class":385,"line":426},[383,937,779],{"class":400},[383,939,394],{"class":393},[383,941,942,944],{"class":385,"line":437},[383,943,839],{"class":400},[383,945,394],{"class":393},[383,947,948,950],{"class":385,"line":443},[383,949,846],{"class":400},[383,951,394],{"class":393},[383,953,954,956],{"class":385,"line":451},[383,955,853],{"class":400},[383,957,856],{"class":393},[383,959,960,962,964,966,968],{"class":385,"line":461},[383,961,861],{"class":393},[383,963,864],{"class":400},[383,965,404],{"class":393},[383,967,685],{"class":389},[383,969,688],{"class":393},[383,971,972],{"class":385,"line":691},[383,973,875],{"class":393},[383,975,976],{"class":385,"line":697},[383,977,978],{"class":393},"                },\n",[383,980,981,984],{"class":385,"line":883},[383,982,983],{"class":400},"                \"swaying\"",[383,985,394],{"class":393},[383,987,988,991],{"class":385,"line":888},[383,989,990],{"class":400},"                    \"animations\"",[383,992,856],{"class":393},[383,994,995],{"class":385,"line":894},[383,996,997],{"class":389},"                        \"sway\"\n",[383,999,1000],{"class":385,"line":899},[383,1001,1002],{"class":393},"                    ],\n",[383,1004,1006,1008],{"class":385,"line":1005},15,[383,1007,853],{"class":400},[383,1009,856],{"class":393},[383,1011,1013,1015,1018,1020,1023],{"class":385,"line":1012},16,[383,1014,861],{"class":393},[383,1016,1017],{"class":400},"\"default\"",[383,1019,404],{"class":393},[383,1021,1022],{"class":389},"\"query.all_animations_finished && query.is_on_ground\"",[383,1024,688],{"class":393},[383,1026,1028],{"class":385,"line":1027},17,[383,1029,875],{"class":393},[383,1031,1033],{"class":385,"line":1032},18,[383,1034,880],{"class":393},[383,1036,1038],{"class":385,"line":1037},19,[383,1039,464],{"class":393},[383,1041,1043],{"class":385,"line":1042},20,[383,1044,891],{"class":393},[383,1046,1048],{"class":385,"line":1047},21,[383,1049,787],{"class":393},[383,1051,1053],{"class":385,"line":1052},22,[383,1054,688],{"class":393},[128,1056,1057],{},"Now we need to link the animation controller to our entity. Animation controllers can be linked the same way as animations in the client entity file. The controller is linked in the animations section and played in scripts.",[375,1059,1061],{"className":377,"code":1060,"language":379,"meta":62,"style":62},"            \"animations\": {\n                \"look_at_target\": \"animation.common.look_at_target\",\n                \"sway\": \"animation.robot.sway\",\n                \"ground\": \"controller.animation.robot.ground\"\n            },\n            \"scripts\": {\n                \"animate\": [\n                    \"look_at_target\",\n                    \"ground\"\n                ]\n            }\n",[225,1062,1063,1069,1079,1090,1100,1104,1110,1116,1122,1127,1131],{"__ignoreMap":62},[383,1064,1065,1067],{"class":385,"line":386},[383,1066,495],{"class":389},[383,1068,394],{"class":393},[383,1070,1071,1073,1075,1077],{"class":385,"line":397},[383,1072,502],{"class":400},[383,1074,404],{"class":393},[383,1076,635],{"class":389},[383,1078,410],{"class":393},[383,1080,1081,1083,1085,1088],{"class":385,"line":413},[383,1082,642],{"class":400},[383,1084,404],{"class":393},[383,1086,1087],{"class":389},"\"animation.robot.sway\"",[383,1089,410],{"class":393},[383,1091,1092,1095,1097],{"class":385,"line":426},[383,1093,1094],{"class":400},"                \"ground\"",[383,1096,404],{"class":393},[383,1098,1099],{"class":389},"\"controller.animation.robot.ground\"\n",[383,1101,1102],{"class":385,"line":437},[383,1103,440],{"class":393},[383,1105,1106,1108],{"class":385,"line":443},[383,1107,524],{"class":389},[383,1109,394],{"class":393},[383,1111,1112,1114],{"class":385,"line":451},[383,1113,531],{"class":400},[383,1115,664],{"class":393},[383,1117,1118,1120],{"class":385,"line":461},[383,1119,669],{"class":389},[383,1121,410],{"class":393},[383,1123,1124],{"class":385,"line":691},[383,1125,1126],{"class":389},"                    \"ground\"\n",[383,1128,1129],{"class":385,"line":697},[383,1130,694],{"class":393},[383,1132,1133],{"class":385,"line":883},[383,1134,464],{"class":393},[128,1136,1137],{},"If you test this in-game, the animation now works more than once. But, depending on the length of your animation, you might notice that if the robot loses the ground two times with a short interval, the second time it won’t play the animation. That’s because the first animation hasn’t finished yet, so the controller hasn’t been reset to the default state.",[128,1139,1140,1141,1144],{},"We'll take a look at a different solution that would solve this problem. By removing the ",[225,1142,1143],{},"all_animations_finished"," query, we'll quit the swaying state as soon as the entity lands again. If we test this again, the animation will stop very abruptly.",[128,1146,1147,1148,1151],{},"To prevent this, we can use the option ",[225,1149,1150],{},"blend_transition",", which allows us to smoothly transition out of the animation in a set time. This is one of the most important properties of animation controllers and even allows us to create a simple transition between two fixed poses of an entity.",[128,1153,1154],{},"Ultimately, which solution is best depends on the use case. In this example, the animation fades out smoothly once the robot lands on the ground again.",[375,1156,1158],{"className":377,"code":1157,"language":379,"meta":62,"style":62},"                \"swaying\": {\n                    \"animations\":[\n                        \"sway\"\n                    ],\n                    \"transitions\":[\n                        {\"default\": \"query.is_on_ground\"}\n                    ],\n                    \"blend_transition\":0.5\n                }\n",[225,1159,1160,1166,1172,1176,1180,1186,1199,1203,1213],{"__ignoreMap":62},[383,1161,1162,1164],{"class":385,"line":386},[383,1163,983],{"class":389},[383,1165,394],{"class":393},[383,1167,1168,1170],{"class":385,"line":397},[383,1169,990],{"class":400},[383,1171,856],{"class":393},[383,1173,1174],{"class":385,"line":413},[383,1175,997],{"class":389},[383,1177,1178],{"class":385,"line":426},[383,1179,1002],{"class":393},[383,1181,1182,1184],{"class":385,"line":437},[383,1183,853],{"class":400},[383,1185,856],{"class":393},[383,1187,1188,1190,1192,1194,1197],{"class":385,"line":443},[383,1189,861],{"class":393},[383,1191,1017],{"class":400},[383,1193,404],{"class":393},[383,1195,1196],{"class":389},"\"query.is_on_ground\"",[383,1198,688],{"class":393},[383,1200,1201],{"class":385,"line":451},[383,1202,1002],{"class":393},[383,1204,1205,1208,1210],{"class":385,"line":461},[383,1206,1207],{"class":400},"                    \"blend_transition\"",[383,1209,682],{"class":393},[383,1211,1212],{"class":400},"0.5\n",[383,1214,1215],{"class":385,"line":691},[383,1216,880],{"class":393},[1218,1219,1220],"style",{},"html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":62,"searchDepth":397,"depth":413,"links":1222},[1223,1224,1229,1234],{"id":171,"depth":413,"text":172},{"id":186,"depth":397,"text":187,"children":1225},[1226,1227,1228],{"id":200,"depth":413,"text":201},{"id":233,"depth":413,"text":234},{"id":263,"depth":413,"text":264},{"id":296,"depth":397,"text":297,"children":1230},[1231,1232,1233],{"id":300,"depth":413,"text":301},{"id":313,"depth":413,"text":314},{"id":320,"depth":413,"text":321},{"id":344,"depth":397,"text":345,"children":1235},[1236,1237,1238],{"id":351,"depth":413,"text":352},{"id":550,"depth":413,"text":551},{"id":723,"depth":413,"text":724},"md",{"authors":1241},[1242],"JannisX11",true,{"title":84,"description":86},"guides\u002Fbedrock-modeling","QyghSD1kxjYZNuZvq_b-skFMfCzkWIbLYG8NWCo_L0M",1776013264587]