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:12]
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 93: Line 93:
 </​code>​ </​code>​
  
-=== Animatie fundal ​===+=== Background animation ​===
  
 To animate the background of a 2D game, we can alter the position of the texture. Thus, we must define a material with a texture, and 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 textures, to which we can add an offset, depending on the position of the character, or a movement in time, etc. To animate the background of a 2D game, we can alter the position of the texture. Thus, we must define a material with a texture, and 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 textures, to which we can add an offset, depending on the position of the character, or a movement in time, etc.
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.1571832743.txt.gz · Last modified: 2019/10/23 15:12 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