- Home /
How to animate an object outside of camera field of view?
I have an animated model which is initially outside the camera field of view (i.e. not visible). When the level starts the animation is supposed to bring the object into the field of view. But, alas, the animation does not seem to play if the object is not visible.
So, is there an intended way to cope with this?
I unchecked the "Animate Only if Visible" property of the animation without obtaining any difference in behavior.
There seems to be a post in the forums which mentions the issue: http://forum.unity3d.com/viewtopic.php?t=30401&start=0&postdays=0&postorder=asc&highlight=animate+visible
Someone explains a workaround that involves adding a camera, which does not work for me. Another workaround is to set a property "Update When Offscreen" of skinned mesh renderers, which is rather inconvenient when the object has a lot of skinned mesh renderers, and does not say what to do in the case of having a non-skinned mesh renderer.
Update: I'm currently using the following script attached to the model in order to avoid setting by hand the property "Update When Offscreen" in the many nodes that need it.
import UnityEngine
class UpdateWhenOffscreen (MonoBehaviour):
def Start ():
for mr as SkinnedMeshRenderer in GetComponentsInChildren(SkinnedMeshRenderer):
mr.updateWhenOffscreen = true
Answer by Eric5h5 · Apr 26, 2010 at 11:12 PM
"Update when offscreen" isn't a work-around, it's the correct thing to do. Typically an animated object will have a single skinned mesh renderer, so most of the time it's just a matter of checking one box. The case of having a non-skinned mesh renderer is a non-issue, because that can't have any mesh animation anyway so you don't have to worry about it.
Thanks for the explanation. It looks like I'm not on the typical case :). The documentation for "Update When Offscreen" seems to complement a bit the subject: http://unity3d.com/support/documentation/Components/class-Skinned$$anonymous$$eshRenderer.html
Your answer
Follow this Question
Related Questions
Can the animation editor create local rotational data? 3 Answers
Adding animation clips via script 2 Answers
Can I make animations snap to a frame? 1 Answer
How to select an animation clip by index number? 7 Answers
Play Animation A after Animation B ends 3 Answers