- Home /
Simple animations - hardcoded or import animation
For simple animations, such as "fist pow" (move from position 1 to 2 linearly) or shaking (for-loop a few random positions and rotations near a center position), is it better to import the animation or simply hardcode it in script (see parentheses for hardcode algo) using transform.position
and transform.rotation
?
Answer by runevision · Jan 17, 2011 at 10:03 AM
There is no "best" way - just do what you are most confident with.
Only exception is if this is performance critical, which is only likely if you are on a mobile device, and/or you have many instances of this code running at the same time.
In that case, see this question and answer: Rotating objects: Script vs. Animation efficiency
Don't do premature optimization though. First measure that this is actually having a measurable effect on the frame rate.