Technologies of Unity
The animation only shows up the clip offset when it is animating the root transform. It doesn’t apply otherwise if the animation position is meant to offset. If you want to keyframe the position/rotate, you can create it by an override track.
Unity has Relative Position Animation
The powerful animation editor in Unity is Position Animation. To a Game Object, an Animator component of the concept is attached, and the Animator then attaches an Animator Controller. To maintain and arrange a set of Animation Clips is allowed by an Animator Controller and a character or object is associated with Animation Transitions. Along a timeline of keyframes, an Animation Clip defines you with the Game Object properties on Animations.
Erwin Broekhuis’s video tutorial explains in a parent object how to wrap the animated object and Animator attached to the parent. However, the Animation component which is used in the video has deprecated the Animator component in favor.
Step 1: How the Parent Object is created
The hierarchy is created by an empty object off the root. The parent can be named whatever you like, but it is called a Parent here.
Step 2: Child Object to be added
Under the parent-child object is added. Cube 3D objects are simply added in this walkthrough. Transform position (0, 0, and 0) is the default of the child object; it is a relative position to the parent. It is called Cube, but you can name the child whatever you want.
Step 3: to the parent Animator Component is added
In the parent object, the Animator component is added. In the miscellaneous category, the Animator Component is found.
Step 4: Animator Controller is created
The state transitions and the animation clips are managed by an Animator Controller which we need to create. Create a folder named Animation where you store animation clips and an animation controller. Right-click on the Animation folder in the Project window, and choose to Create>Animator Controller. CubeAnimatorController is the name given here to the controller, but you can name it by your own choice.
Step 5: to Animator attach the Animator Controller
By dragging the Animator Controller, attach the property of the Animator onto the Controller. For doing this first, select the Parent object from the hierarchy and in the Project, window click the Animation folder.
In the Inspector window under Animator drag CubeAnimatorController onto the empty Controller box from the Animation folder.
Step 6: Creating Animation Clip
From the Unity Editor Menu open Window>Animation from the Animation window if it is not open earlier. The Animation window can be placed anywhere you like. Place the Animation window in such a way that it is visible from the Animation window and Scene window at the same time.
From the Hierarchy window select the Cube object. When you click on the Animation tab, the Animation window should be visible. It should be kept in motion while creating an animation clip.
A dialog box will open when you press the button to create an animation clip to save the location of the animation clip. It is better to save it in your Animation folder in the same place where the Animator Controller has been saved. Give the name as CubeMove for this animation clip.
While creating the animation clip a corresponding state is added to the Cube AnimatorController in the Animator you have attached. State transitions or Animator Controller related to this are not covered in this blog.
Step 7: Cube’s Transform is added to the Animation Clip in Position Property
Click on the Add Property button in the Animation window by selecting the CubeMove clip. Cube>Tranform>Position choose this instead of expanding Cube and the Transform object should not be selected.
In the Animation window, the Cube Position property is seen, one at 0:00 and another one at 1:00 added to the timeline with two keyframes. The Frame number is referred to in these times. 1 second at 60 frames per second has 60 samples of animation by default.
Step 8: how to add a Keyframe to the Animation
At 0:30 position timeline click then add a keyframe by clicking on the button Animation window. You will get a “record” mode in the Animation editor with a few visual cues:
- Depressed record button
- With red color in the Unity Editor at the top with the buttons of the game Play/Pause
- The attributes of the Transform Position property you will get red-colored for the Cube in the Inspector.
Attributes of the Transform Position property have to be changed. For example, 0 to 2 has to be changed from X.
Note: in the Hierarchy window both the Parent and the Cube objects are selected at this point and to the animation clip Transform. The position will be added to both of them. From the animation, if you choose to remove the properties right click on the Parent.Transform.Position. It ensures that this key to the current position in the animation remains relative to the parent object.
To stop recording click on the Record button in the Animation
Step 9: Animation testing
To test your animation, in the Animation window press the Play button. From its start position to return, you see your X-axis along with the Cube sliding 2 units.
Step 10: Repeat the test and move the Parent Object
Move the Parent object to check that the expected relative animation works are perfect and click the Play button again in the Animation window in the scene while moving the Parent object elsewhere. If it is correctly configured, the new location of Parent animation should begin and 2 units should be animated along the X-axis and back. The originally recorded animation should not jump from the location.
Animation Parameters introduction in Unity
Within an Animator Controller, AnimationParameters defined variably that the scripts are assigned with values and that can be accessed. The state machine affects the flow and the script can be controlled.
By an animation curve parameter of the value can be updated, and then a script can be accessed so that, a piece of animation can be varied with the pitch of a sound effect. Likewise, Mecanim parameter values can be set with a script to be picked up. For example, to control a Blend Tree set a parameter of a script.
The values of the parameter can be set default by the Animator window’s Parameters section, Animator window is selectable in the right top corner. They are of four basic types:
Integer – an entire number
Float – fractional part of a number
Bool – by a checkbox a true or false value is represented
Trigger – the controller is reset by the Boolean parameter when absorbed by a transition (circle button is represented)
Using functions from script parameters can be assigned values in the Animator class: SetInteger, SetFloat, SetTrigger, SetBool, and ResetTrigger.
In Unity setting up characters with Animations with the Animator Controller
2D Characters Animating in Unity
An illusion is the very core of animation this is “The Illusion of Life”. Everyone thinks that a living character looks best when it produced a greater illusion. Doesn’t it make sense? Recognition or memory triggers a living being when we see an animation. Therefore, the animator’s task is to move the real world with the rules because the illusion is increased what you are seeing, moving, and functioning in a real life. For a 2D character, we create this “Illusion of Life”.
2D Game Animations in Unity
2D walking in Unity in the Simple Animation States
In Unity Animating and Rigging a 2D Character
In Unity how we can quickly rig and animate a 2D character with the 2D tools and Animation package. The following package of Unity versions:
2D Animation package version 5.x.x – Unity 2020.2 or later
- 2D Animation package version 4.x.x – Unity 2020.1
- 2D Animation package version 3.x.x – Unity 2019.3
PSD Importer integration and 2D Animation
To easily import your character artwork you can use the PSD Importer with the 2D Animation package for animation from Photoshop into Unity. The import of Adobe Photoshop .psb files into Unity that supports the PSD Importer is an Asset importer and based on the source file a Prefab is made of Sprites and its layers.
The more common Adobe .psd format, the .psb file format has identical functions with larger image sizes. To know more about the importer’s features you will get it in PSD importer package documentation.
PSB format in Adobe Photoshop
2D Animation package for a character animation we require the PSD Importer package. The Adobe Photoshop .psb format is only imported by the PSD importer package and the Adobe .psd format is not imported.
Optional Performance Boost
From the Package Manager, you can install the Burst and Collections package and can be improved the performance at the runtime of the animated Sprite’s deformation. To speed up Unity’s processing this allows the 2D Animation package to use Burst compilation.
Disclaimer: The content on this site belongs to its respective owners. We don’t have any claims on images or content. The intention of this blog is to Public Awareness / Knowledge base and provide insight to readers.
Headquarters in Newark, DE, United States of America. And has a production facility in Bangalore, Karnataka, India. P66 is one of the Best 2D & 3D Production mushroom-sized Creative Agencies. Aiming to provide the Best Creative Services at a very affordable cost. P66 is a studio which is specialized in Traditional & Digital Types of Animation. It has provided contributions in the areas of 2D Animation, 3D Animation, Motion Graphics, Free-hand drawing, Drawing & Illustration, Digital Comic Books, Digital 2D Painting, Concept Artistry Drawing, 2D & 3D Game Designing, and E-learning for kids To provide a FREE Consultation about the services of P66 do reach us on +1 (914) 247-7791 or Email us at: Reply@p66.me