Unity 3D Game Engine – Animation Properties

Unity 3D Game Engine – Animation Properties

Import Animations stored inside a .fbx file

1. Import your character inside a .fbx file> Inspector> Animations

2. Check ‘Import Animations’> Apply, Unity will import animations stored inside .fbx file

– Bake Animation: convert the animation to IK to FK

– Compress: Off – KeyFrame Reduction – Optimal
(a mio parere è megli effettuare queste ottimizzazioni dentro a 3DSMAX prima di esportare in .fbx)
— Errors, the smaller the value the higher is the precision the less compression you get

– List of clips avaiable inside the .fbx> + or – to create clips o remove clips

3. Select a clip

– Loop Time: check if you want loop the animation

– Traffic signal: click over it to see a graph, it can be green (il loop è buono perchè la posizione di inizio e fine si somigliano), giallo (loop meno buono), rosso (loop pessimo)

– Root Transform Rotation
— Bake Into Pose: se attivo l’Avatar di Unity non ruoterà anche se nell’animazione originale da 3DSMAX ci saranno dei cambi di direzione. Si attiva nelle animazioni dove il personaggio deve procedere diritto, come una camminata o una corsa standard.
— Based Upon (at Start):
— Body Orientation: la rotazione del pelvis si baserà sulla posizione iniziale all’interno di Unity
— Original: la rotazione del pelvis si baserà sulla posizione iniziale all’interno di 3DSMAX

– Reset Transform Position Y
— Bake into pose: se attivo il personaggio non si sposta in Y

– Reset Transform Position XZ
— Bake into pose: se attivo il personaggio non si sposta sul piano X, si sposterà solo in Y

By |Unity3D, Video Games Development|Commenti disabilitati su Unity 3D Game Engine – Animation Properties

Unity 3D Game Engine – Humanoid Avatars

Unity 3D Game Engine – Humanoid Avatars

Inside Unity 3D ‘Avatar’ you can store informations about rig and skeleton.

1. Import a character in .fbx format

2. Project Window> select the imported object> Inspector> Rig

– Animation Type: select Humanoid

– Avatar Definition:

– Create From This Model: to create a new Avatar

– Copy From Other Avatar: to import an existing Avatar

– Optimize Game Objects:

– check, Unity will create his own optimized character bones, it will improve your game performance.
In most cases it is the best way.
Se importo da 3DSMAX+Biped, Unity seleziona tra le ossa di Biped solo quelle che gli servono,
il resto restano presenti ma sono disattivate.

– uncheck, Unity will create a lot ‘Empty Game Objects’ to represent all character bones.
You will have more control over bones structure, but it is much less efficient.
Se importo da 3DSMAX+Biped resta la struttura ossea completa di Biped.

-> La soluzione migliore è a mio avviso utilizzare poche ossa direttamente in 3DSMAX,
in questo modo si otterrà più controllo sull’animazione finale.

– Extra Transform to Expose (you will see that if ‘Optimized Game Object is checked’)
If you want to add a cup of coffee to the hand of your character, you will need to expose the hand transform.
Click ‘+’ button> select from the drop down menu the Hand

3. Inspector> Rig> ‘Configure’ button> Apply if request
For a Humanoid Character you do not need a lot of bones. If you do not have too much bones it will improve your game performance.

unity3d-001

unity3d-002

unity3d-003

unity3d-004

unity3d-005

– Mapping: the bone definition

– Bottom, ‘Mapping’ button> Automap, it is the automatic mapping function, it works well in most cases.

– Pose: TPose, it works best in Unity than other poses.

– Muscles: to test deformations and apply the limits of the joints.

By |Unity3D, Video Games Development|Commenti disabilitati su Unity 3D Game Engine – Humanoid Avatars

Unity 3D Game Engine – Blend Tree

Unity 3D Game Engine – Blend Tree

Blend Tree is useful to mix two or more Animations, for example if you have animation for ‘Running Left’ ‘Running Right’ ‘Runing Foward’ ‘Running Backward’.

1. Animator Window> RMB over an empty space> Create a State> From New Blend Tree>

2. Inspector> inside Motion Slot you will see ‘Blend Tree’ NOT a single Animation!

3. Animator Window> double click ‘Blend Tree’> Inspector:

– Name of Blend Tree

– Blend Type:
— 1D (one dimensional), it uses a single parameter, for example ‘Speed’ (value from 0 to 1)
Usa un parametro singolo per gestire l’animazione

— 2D Simple Directional, it use direction to make transitions
Usa una animazione per ogni direzione, ad esempio walkfoward walkbackward walkleft walkright

— 2D Freeform Directional, it use direction to make transitions
Usa più animazioni per la stessa direzione, ad esempio walkfoward walkbackward walkleft walkright + runfoward runbackward runleft runright

— 2D Freeform Cartesian, it use direction to make transitions

– Motion> ‘+’:
— Add Motion Field
-> DRAG AND DROP an Animation, for example ‘Run’
-> DRAG AND DROP an Animation, for example ‘Walk’
-> DRAG AND DROP an Animation, for example ‘Sneak’
or
-> click over the small circle icon
— New Blend Tree, to add nested Blend Trees (nidificati)

4. Inspector> Play animation preview and change Animator Window> Blend Tree level> Speed slide you will see:
– Speed 0 -> Run
– Speed 0.5 -> Walk
– Speed 1 -> Sneak

5. Inspector> Use the handle in the left to DRAG UP or DOWN the Motion Slots to change animations order.

– Automate Threshold (soglia):
– check it to automate threshold (crea un’interpolazione automatica)
– uncheck
— Speed
— Velocity X / Y / Z
— Angular Speed Rad / Grad

– Adjust Time scale
— Homogeneous Speed
— Reset Time Scale

By |Unity3D, Video Games Development|Commenti disabilitati su Unity 3D Game Engine – Blend Tree

Unity 3D Game Engine – Animator Controller

Unity 3D Game Engine – Animator Controller

Animator Controller

Animator Controller is a ‘state machine’, it is used to mix and blend animations.
Animations are stored inside blocks and you can drive blocks using parameters, parameters are changed by scripts.

The workflow is:

Character GameObject -> Animator Component -> Animator Controller (it is used to define animation clips) -> Animations -> Parameters -> Scripts
-> Avatar (it is used to define rigs and skeleton)

It is said that it is complicated but very useful to make realtime-interactive animations, let’s go on!

1. Select a 3D Model> Inspector> ‘Add Component’> Miscellaneus> Animator (prima di tutto creo Animator Component)

2. Project> RMB> Create> Animator Controller, give it a name

3. DRAG AND DROP Animator Controller over Hierarchy> Inspector> Animator Component> Controller

4. Double LMB over Animator Controller will opes Animator window

Animations

They are the animation clips

5. Project> DRAG AND DROP Animations over Animator Window, example ‘Idle’ (poltrire) and ‘Run’ (correre) animation

6. RMB over your default animation block> Set As default, example ‘Idle’

7. Animator Window> select your animation ‘Idle’> Inspector>
– Speed = 1 to run animation at normal speed, 2 to doble speed etc…
– Motion: the motion clip
– Foot IK: check it to reduce or remove foot slipping (elimina lo slittamento dei piedi)
– Mirror: it flips the animation left to right
– Transitions: list of transitions for this animation

Parameters

Parameters are used to manage behaviours and to take decisions, they can be:

– Float
– Int
– Bool
– Trigger

8. Animator Window> Bottom Left> Parameters> ‘+’> Float> create ‘Speed’ parameter.

Transitions

Transitions lets you move smootly from an animation to another.

9. Animator Window> RMB over ‘Idle’ Box> Make Transition> LMB over ‘Run’ Box

10. LMB over the Transition Arrow

11. Inspector, bottom, Play the Preview of transition

12. Inspector>

– Mute: stop the effect transition, use it for debug pourpuse only, uncheck for build the executable
– Solo: stop the effect of transition that comes from the same state, use it for debug pourpuse only, uncheck for build the executable
– Give a name
– Atomic: check -> the transition is not interruptible by other transitions
– DRAG the Transition Blocks
– Conditions

By |Unity3D, Video Games Development|Commenti disabilitati su Unity 3D Game Engine – Animator Controller

Unity 3D Game Engine – Animation – Animator Component

Unity 3D Game Engine – Animation – Animator Component

With the Animator Component you can drive and mix animations inside Unity 3D Game Engine.

Overview

1. Select a 3D Model> Inspector> ‘Add Component’> Miscellaneus> Animator

Parameters:

– Controller: it is a ‘state machine’, it is used to mix and blend animations.

– Avatar: it is used to define rigs and skeleton. If you have a generic object without skeleton rig, Avatar will not be required.

– Apply Root Motion:
check -> the character move around (se attivo il personaggiosi anima e si muove nello spazio 3D, necessario se il personaggio si muove in un mondo 3D)
uncheck -> the character shand in place (se inattivo il personaggio si anima ma resta sul posto, utile se ad esempio sarà il fondale a scorrere)

– Animate Physic:
check -> animation will be executed in time with the physic engine, it is check if you use a Rigid Body component with your character (lo attivo se ho un Rigid Body attaccato al mio personaggio che deve interagire con la fisica dell’ambiente circostante)
uncheck -> you will leave unchecked if you do not use physic

– Culling Mode: (Modalità abbattimento/ottimizzazione)
Based on Renderers -> the animation will run only if it is rendered (animazione cicla solo se deve essere renderizzata)
Always Animate -> the animation will run ever (animazione cicla sempre anche se il personaggio non è renderizzato)

By |Unity3D, Video Games Development|Commenti disabilitati su Unity 3D Game Engine – Animation – Animator Component