The Circuit is ON!! XD

Literally four whole days (and nights) working on the components including separating models, reallocating actions, resetting smooth shading and UV unwrap, painting textures, sorting and cleaning animations, dealing with the hierarchies, and the codes…..

Animation

So now I eventually became quite familiar with Blender’s animation system and figured out how to store multiple clips for one file to Unity. In NLA editor I drag all actions I need into one track and delete others so that they won’t show up again in Action editor (become “0”, precisely, and disappear when opened next time. Cos I’d been confused why they were still not “0” although I checked all objects and no one was using them). And also, Unity’s clip list become clean now. Note that you have to delete the current action of the armature to <No Action> or all the clips would play the current action.

屏幕快照 2016-07-21 01.39.48

Therefore as all humans are using the identical rig, I can then append my prefab one (shape keys & modifier problem fixed) into each model file. I also found that it was because the parent-child relationship things that when I imported the models into Unity the components were always messed up in transformation. It seems that if I had more than one objects have parent relationships with a single object/bone, then it wouldn’t work properly. Like if I had both the hair and eyes set to the head bone, they’d fly away in Unity but if only hair, and eyes set to the eyes’ bone (moving paralleled), then everything’s fine. Neither .blend or .fbx. The same problem in complex animations such as something was set to a bone of an armature, and it had it’s own armature deforms or something set to it’s bones at the same time, then… well that’s confusing because the original models of human on horse animation work in the blend file’s default take (human has its own animation and is parented to the horse’s back bone); but when I had more complex things, I wasted hours on trying to figure out where went wrong, and failed.

My workaround is just separating things into single clips. The mount in one blend file, the human (if multiple humans, store them into clips in one fbx file, cos fbx can have shape keys animations), and birds on the head or something held by hand etc… then in Unity’s hierarchy, unfold their components, place the human as the child of the mount’s back bone, and place the others as the child of what it should be. Not really troublesome and very safe.

circus

Hierarchy

Allocate the animator controller to everyone who has animation. Then, each human(s) with the mount and the related objects is set to an empty game object. That game object carries the moving script and a box collider. There’s also a “circuit” game object being the parent of everything here and it’s at the centre of the pond, so everyone can have a local position around the pond which is easier for the script.

As there had been more and more objects in the circuit I decided to sort them into crowds, and actually they are in crowds in the painting as well. I used numbers as in the clock then I found there were exactly 12! Brilliant.

So in the code I call the transform.localPosition to get the angle and radius (it’s an ellipse though so z divides 0.7 :P). Then angle+=speed and localPosition goes to its cos and sin. And finally use a Quaternion.LookRotation(Vector 3).

屏幕快照 2016-07-20 01.22.24屏幕快照 2016-07-20 01.19.28

屏幕快照 2016-07-19 18.03.32屏幕快照 2016-07-20 12.00.30

So that’s about the important things this week, easier said than done! How painful it should be to learn something…. I love painting textures though! Although Blender always has awful unfilled seams.

OK it’s too much for gifs this time so here’s a extremely unclear screen grab!! Forgot to say, it’s still even not everything in the circuit actually T___T