Culling Mode: Always Animate!

Something funny happened to me today, I am coding a script to position the camera pointing to the characters and for the target of the camera I was using a joint of this character (the root, so I can precisely track its position for a more cool look in my case). Something weird started to happen, when I had my scene view open the camera was positioning at the correct position, but when the scene view was closed the camera was positioning slightly to the right or left (I am working on the battle system and the camera keeps switching its position and rotation to focus the attacking creatures or creatures taking damage and etc).

The cause of the issue was, the camera was being positioned where the last position of that joint was seen because the culling mode of the Animator of these characters was set to don’t animate the character when the camera was not facing it (Cull Completely), the character was not going back to its original position because I programmed something to change the camera after a part of the animation attack happens (to give a more fluid look to the battle). When the scene view was open I had all the characters and the camera framed to try to understand what was happening and that was causing the animator to update even if the character was not being observed by the game camera.

phew! I was already thinking that there was a bug in Unity’s code that was out of my control, the lesson is: if you rely on positioning stuff based on character joint’s transform, never forget to set the animator culling mode to always animate or you may face similar problems when the this character is not being rendered by the camera!

Cheers!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s