Archive 17/01/2023.

Any Expense if Setting AnimationState.Time to Previous Value?

Jens

Just wondered if assigning a non-changed value to AnimationState.Time will incur any expense, or should there be a condition to check before doing this in OnUpdate()?

SirNate0

A very minimal cost as AnimationState.SetTime has the condition check inside it:

Jens

Thanks SirNate. I kind of guessed and feel slightly embarrassed I didn’t look that up. However, while I’ve got you on the line as it were, do you think animating a single bone would be much more expensive than the corresponding manual operations, eg. get position/rotational data from other bones and then use to position and rotate the single bone? My guess (or rather hope) is that animating the bone might even be less expensive.
​​
​​​​​​​​​​​

SirNate0

Not sure exactly what you mean, but it’s probably comparable.

It sounds to me that you want to create an animation from one bone and then apply it to another bone. It’s probably about the same cost as doing it all “manually”. Unless you are doing thousands of these, the performance probably doesn’t matter either way. Unless you have good reason to believe this will be the performance bottleneck, just get it done first however and optimize it later if it is in fact an issue. I suspect if it ends up being an issue you will want to use C++ for it and do the optimization there in any case.

Jens

Ok thanks, I guess it is only one bone anyway.
It does not really matter now, since the 4 animations (2 for the character and 2 for the object he is holding) are not aligning properly - close, but not good enough. So, I’m back to doing it the original way - the problem there, that made me try animating the held object in the first place, has been made into a new post.