How to create Flag in Unity3D

How to create Flag in Unity3D

In this article, we are going to learn How to Create a Flag in Unit3D. For creating a flag we are going to use the following image.

We are going to create two flags by using two images shown above. The first Image is without any transparency. In the second image, we have transparency.

At the time of writing this article, we used Unity 3D version 2017.3.  Steps may vary in Older or newer versions of Unity 3D.

Following are the steps to create our first flag.

Steps to create our first flag.

  • Add images to Assets folder
  • Create a new Plain in your scene
  • Rotate your plain so you can see it’s front face.
  • Apply flag image on your plain
  • For displaying your flag image both sides use the double-sided shader. Download it from https://www.assetstore.unity3d.com/en/#!/content/23087
  • Now it’s time to add Cloth physics in our plain.
  • Edit Cloth constraints from the inspector. It may be vary based on the type of flag you want to create.
  • Finally, add External Acceleration and Random Acceleration.
  • If you are using any Flag Pole add a Capsule collider for your pole.
  • Add pole in your plain Capsules Colliders.

Following are some important properties of Unity3D Cloth

Property: Function:
Stretching Stiffness Stretching stiffness of the cloth.
Bending Stiffness Bending stiffness of the cloth.
Use Tethers Apply constraints that help to prevent the moving cloth particles from going too far away from the fixed ones. This helps to reduce excess stretchiness.
Use Gravity Should gravitational acceleration be applied to the cloth?
Damping Motion damping coefficient.
External Acceleration A constant, external acceleration applied to the cloth.
Random Acceleration A random, external acceleration applied to the cloth.
World Velocity Scale How much world-space movement of the character will affect cloth vertices.
World Acceleration Scale How much world-space acceleration of the character will affect cloth vertices.
Friction The friction of the cloth when colliding with the character.
Collision Mass Scale How much to increase the mass of colliding particles.
Use Continuous Collision Enable continuous collision to improve collision stability.
Use Virtual Particles Add one virtual particle per triangle to improve collision stability.
Solver Frequency Number of solver iterations per second.
Sleep Threshold Cloth’s sleep threshold.
Capsule Colliders An array of CapsuleColliders which this Cloth instance should collide with.
Sphere Colliders An array of ClothSphereColliderPairs which this Cloth instance should collide with.
0 Comments
Leave A Comment

Please login to post your valuable comments.

Join the newsletter

Get the latest vLemonn news first

share