What is the fastest way ? animation or algorithm ?

Let’s say that I would like to rotate an airplan, I can use animation in Maya and let unity play it, or I can use complicated algoritm in scripts to rotate the airplan smoothly, what is the fastest ?

what about destruction a building, again, the animation is fastest ?

It depends really, animation would be alot simpler, however take into account that some things may require code, you will have to use your best judgement

It all depends on the level of control that you need. For an airplane, I would go with rotating via code. It’s a simple enough function (Quaternion.Slerp() is your friend), gives you a lot more control over the exact rotation and it’s more memory efficient since you only need the mesh itself and no baked animation.

For a building, animation would probably be the easier approach, but you’ll run into the problem that it will look exactly the same for each and every building. Judging by personal preference, I would use a semi programmatical approach for that as well. Split the building into nice chunks in your modeling Program (preferably making sure that all meshes are convex), and if you want to destroy it just add/activate a rigidbody for each chunk, enable gravity and apply some forces and let Unity’s physics engine do the rest. This will however have quite an impact on performance, so if you’re developing for a slow platform like a mobile device, the animation might be the better choice.

I should change the Question: What is the Best for the CPU: to run a script or to play back an animation ?