I am trying to implement an opening curtain in Unity. It covers a window and when the player clicks on it, it will move to one side. Since it doesn’t need to be dynamic I made the simulation in Blender (because navigating the space and setting things up feels easier for me than using Unity for that task.
Now I got 200 frames of curtain animation but don’t know how to get this mesh animation to Unity. Most tutorials deal with armatures or bones and the importer in Unity does not recognize the baked animation in the FBX file. I tried a recommended way to export and import as .mdd file in Blender that creates shape keys for every frame but those aren’t recognized as well.
One idea that might work is that you could tween between meshes that you import so that they have same point order.
This would also allow you to only have the amount of keyframes (meshes) you need. I’m not sure how fast this might perform and if it’s good idea for your use-case, but certainly doable. But you would need to write / or get some code for this.
Thanks, this is a nice idea but more suited to a handful of meshes, I guess I would need a lot of meshes because the simulation is not very “linear” to tween. It would surely work, I could even switch the whole mesh every frame, but it sounds like a “hack”
So it worked, now I am putting everything together and simulate and export a real curtain with wall fixtures etc., import it in Unity, check if I can trigger the animations with an animator controller and if that works, I will try to post the solution here again.
So that is the final result so far. It has way too many polys but I don’t care right now
I hope I will find the time to make a small video tutorial about that at the weekend. The key to success was to delete the cloth modifier before exporting (but of course have the shape keyframes from the mdd import) and in the fbx export settings UNCHECK NLS strips and All actions.
Hello Olipool this curtain is really looking great I am wondering have you found a time to make a small tutorial video about that =) If you could you share it with me
Hi Batuhan, thanks for the compliment I had to solve so many problems in that game that I had no time to make one tutorial so far. But thanks for the reminder, I hope I can make it this week, won’t be very polished but will show the steps needed
Finally, it is finished, hadn’t thought it would take that long to make, cut and upload for such a short tutorial
Some right-click menus in Unity are not shown, I don’t know why, must be an issue with the capturing software. But if anything is unclear feel free to ask
Wow, amazing! I was googling for the EXACT same answer, and here it is, I mean, you even made a vid tutorial about the solution! Holy crap, it’s fantastic!
Il “devrait” fonctionner avec tout ce qui déforme un maillage. Mais si vous l’utilisez pour des vêtements par exemple, il n’interagira pas avec le personnage et autres.
Hi Olipool! I followed your tutorial (thanks for making it btw), but when I go to remove the cloth modifier or subdivide modifier, the fabric doesn’t keep its shape anymore. I’m not sure what I’ve done wrong, I exported and imported the mdd as in the video, and the shape keyframes all show up…
Hi neetikumar21,
I haven’t tried to make a curtain since then so maybe the new Blender version or plugin of the export may have changed. It sounds to me like the keyframes are not containing the right things. I am just guessing but maybe on exporting, the curtain was not selected or something like that or some setting needs to be turned on. Maybe you need to apply the modifiers now before exporting. Maybe you can try that. If the shape key contains data for the curtain I don’t know why it wouldn’t “deform” the curtain each frame.
And did you bake the animation before exporting?