Differences

This shows you the differences between two versions of the page.

Link to this comparison view

pjv:laboratoare:en:03 [2019/10/23 15:10]
alexandru.gradinaru
pjv:laboratoare:en:03 [2019/10/23 15:19] (current)
alexandru.gradinaru [2D animations in Unity]
Line 23: Line 23:
 === Animator Controller === === Animator Controller ===
  
-Urmatorul pas este sa configuram aceste animatii astfel incat sa le putem folosisi sa putem tranzitiona intre elePentru acest lucruvom folosi un ''​Animator Controller''​. ​Acest controller ​functioneaza ca un automat de starifiecare stare putand fi o animatie.+After making animations (check the tutorials above) the next step is to configure these animations so that we can use themand be able to transition between themFor thiswe will use an ''​Animator Controller''​. ​This controller ​works as a state machineeach state being an animation.
  
-Pentru a folosi animatiile se pot adauga cu drag-and-drop in Animator.+To use the animations you can add drag-and-drop in the Animator.
 {{ :​pjv:​laboratoare:​unitystates5.png?​direct&​300 |}} {{ :​pjv:​laboratoare:​unitystates5.png?​direct&​300 |}}
  
-Pentru animatii fluente si controlatetrebuie sa definim tranzitii intre acesteaTranzitiile au mai multe proprietatiprintre care timpi de activareconditii ​etc.+For fluent and controlled animationswe must define the transitions between themTransitions have many propertiesincluding activation times, conditions, etc.
 {{ :​pjv:​laboratoare:​unitystates11.jpg?​direct&​300 |}} {{ :​pjv:​laboratoare:​unitystates11.jpg?​direct&​300 |}}
 {{ :​pjv:​laboratoare:​unitystates10.png?​direct&​300 |}} {{ :​pjv:​laboratoare:​unitystates10.png?​direct&​300 |}}
 {{ :​pjv:​laboratoare:​unitystates12.jpg?​direct&​300 |}} {{ :​pjv:​laboratoare:​unitystates12.jpg?​direct&​300 |}}
  
-Conditiile sunt folosite pentru ​controla cand are loc o tranzitieSpre exempluputem folosi un parametru de stare, pentru ​trece dintr-o animatie in altasau alte conditii ​(spre exemplu daca este pe sol, in aerprimeste ​damage etc.)+Conditions are used to control when transition occursFor examplewe can use state parameter to move from one animation to anotheror other conditions ​(for example if it is on the ground, in the airreceives ​damageetc.)
  
-Spre exemplu putem folosi urmatoarea conventie pentru un parametru de stare:+For example, we can use the following convention for a status parameter:
   * ken_idle = 0   * ken_idle = 0
   * ken_walk =  1   * ken_walk =  1
Line 42: Line 42:
   * ken_hadooken = 4   * ken_hadooken = 4
  
-si punem conditia de tranzitie de la Idle la Walk ''​state=1''​. ​Acest lucru îi va spune personajuluidacă este în Idle, pentru a tranzitiona la animația de Walk dacă parametrul de stare se schimbă la 1.+and we set the transition condition from Idle to Walk ''​state=1''​. ​This will tell the characterif in Idle, to transition to the Walk animation if the status parameter changes to 1.
  
-=== Schimbarea starilor unui Animator ===+=== Controlling the states of an Animator ===
  
-Pentru a schimba starile unui animator, ​trebuie in primul rand adaugata componenta de Animator ​pe obiect+To change the status of an animator, ​you must first add the Animator ​component to the object
-Apoi, putem controla parametrii definiti prin functii disponibile ​in clasa Animator.+Then we can control the parameters defined by the functions available ​in the Animator ​class.
  
 <code c#> <code c#>
Line 93: Line 93:
 </​code>​ </​code>​
  
-=== Animatie fundal ​===+=== Background animation ​===
  
-Petru anima fundalul unui joc 2D, putem altera pozitia texturiiAstfeltrebuie sa definim un material ​cu o texturasi sa o aplicam pe un obiect ​(de obicei un quad). ​Dupa care avem la dispozitie componenta de Render in care putem accesa materialul si implicit texturilela care putem adauga un offset, ​in functie de pozitia caracteruluisau o miscare ​in timp etc.+To animate the background of a 2D gamewe can alter the position of the textureThuswe must define a material ​with a textureand apply it on an object ​(usually a quad). ​After that we have at our disposal the Render ​component ​in which we can access the material and implicitly the texturesto which we can add an offset, ​depending on the position of the characteror a movement ​in time, etc.
  
 <​code>​ <​code>​
Line 107: Line 107:
 </​code>​ </​code>​
  
-Pentru a functiona corecttextura pe care o folositi trebuie sa fie setata pe ''​Repeat''​+To work properlythe texture you use must be set to ''​Repeat''​
 {{ :​pjv:​laboratoare:​2018-10-24_2_li.jpg?​direct&​300 |}} {{ :​pjv:​laboratoare:​2018-10-24_2_li.jpg?​direct&​300 |}}
  
Line 113: Line 113:
  
 For shooting animation, a status is generally used to update the player'​s animation, and the projectile is generated as follows (recommended):​ For shooting animation, a status is generally used to update the player'​s animation, and the projectile is generated as follows (recommended):​
-   * A script is added to the weapon (which is on the scene) that manages the projectile generation and direction +  ​* A script is added to the weapon (which is on the scene) that manages the projectile generation and direction 
-   * Starting from the location of the weapon, a projectile (using the Instantiate function, already studied) is instantiated (prefab as a rule, it must not already exist on the scene, using the position of the weapon). The projectile has attached a script containing details of speed, damage, etc. +  * Starting from the location of the weapon, a projectile (using the Instantiate function, already studied) is instantiated (prefab as a rule, it must not already exist on the scene, using the position of the weapon). The projectile has attached a script containing details of speed, damage, etc. 
-   * The projectile has a continuous translational motion in one direction, until it reaches a limit or collider when it triggers+  * The projectile has a continuous translational motion in one direction, until it reaches a limit or collider when it triggers
  
 === Animations and scene instancing ==== === Animations and scene instancing ====
Line 138: Line 138:
 </​code>​ </​code>​
  
-=== Colision ​===+=== Collision ​===
  
 For collision detection a collider2D can be used. For easy interaction,​ a Trigger can be generated at the collision event by ticking the ''​Trigger''​ box in the component. After that you can retrieve the event and the object with which the collision is made. For collision detection a collider2D can be used. For easy interaction,​ a Trigger can be generated at the collision event by ticking the ''​Trigger''​ box in the component. After that you can retrieve the event and the object with which the collision is made.
pjv/laboratoare/en/03.1571832631.txt.gz · Last modified: 2019/10/23 15:10 by alexandru.gradinaru
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0