Search Unity

Which performs better? Manipulating rigging bones manually at runtime or an animation

Discussion in 'Scripting' started by jococo, Sep 1, 2014.

  1. jococo

    jococo

    Joined:
    Dec 15, 2012
    Posts:
    232
    Hello,

    Which performs better?

    1. Manipulating rigging bones manually at runtime in LateUpdate (i.e. make character head tilt up)

    Code (JavaScript):
    1. CharacterHead.transform.localEulerAngles = Vector3(0,0,30);
    2. Import an animation which you have to setup, etc, etc ...

    I'm finding I am "enjoying" the process of manipulating bones at runtime to create some interesting animations (as opposed to creating animations and importing them). However, I don't want to head down the path too far if it kills performance.

    Thanks!
     
  2. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    I'm not 100% sure, but animation will probably be faster since it's being handled under the hood. If the speed difference is actually big enough to matter would just require careful benchmarking I think. Obviously it also depends on the overhead of the calculations you're using.

    Hmm... actually there's an IK asset in the store I was reading about, it's doing quite a bit of procedural animation with pretty minimal overhead, so I think that as long as your calculations aren't crazy and you're not scaling the number of animation characters into something crazy you should be fine.