Physics 2D
This section describes how to create physics-based animations.
Applying Physics Preview
What kind of animation can be created by applying physics?
The built-in Physics Engine in Unity handles the physics for gameobject interactions and the various effects like gravity, acceleration, collisions, etc.
For the NFT avatar, you might want to use the hinge joint for the hair simulation or the spring joint for jiggling
Overview: How to apply physics in Unity
In order to create these types of simulations, you will need to implement 2D physics something that Unity excels at.
Settings for specific cases
Case 1: an example of physics acting in the same direction as gravity
Bones are set up and positioned at an irregular location
No
2D Box Collider
is needed for the head bone
Setup
Apply weight of the helmet part to static or higher hierarchy bone in this case,
BoneHead.
Apply evenly distributed weight to the strap with the desired number of bones. 6 bones are used to execute a chain-like movement.
Problem
The root bone of the strap becomes disjointed when the scene is played.
This is caused when the
Body Type
of the[Rigidbody 2D]component
is set toDynamic
Solution
Apply
Static
forBody Type
This will result root bone of the strap following its mother bone when the scene is played.
Finessing edges of the sprite image
Problem
by Default, in
[Hinge Joint 2D]
, thereโs no limit is set in angles that will cause breaking edges when the avatar is projecting dynamic movements.
Solution
Apply angle limits by enabling the check box of
Use Limits
and input values inAngle Limits
For this particular image, Itโs best to have a direct child bone, which is the 2nd bone of the strap, and leave other bones under it without any
Angle Limits
applied.
Case 2: an example of physics acting in the opposite direction to gravity.
Bones are set up and positioned at an irregular location
Needs to bleed out of the scene
Needs to float upwards
Setup
Apply weight to the head part to static or higher hierarchy bone in this case,
BoneHead.
Apply evenly distributed weight to the rainbow with the desired number of bones. 3 bones are used to execute a chain-like movement.
Finessing for the expected outcome
To bleed out the image outwards, reposition the last bone upwards
Since the Rainbow needs to float, set
Gravity Scale
to a negative value in[Rigidbody 2D]
Itโs best to have direct child bone, which is the 1st bone of the rainbow, in
Static
forBody Type
in[Rigidbody 2D]
Apply angle limits for the remaining bones by enabling the check box of
Use Limits
and input values inAngle Limits
Result
Rainbow bleeds out
Limited angle set to minimize movements of the rainbow
Last updated