Sprite add shadow swing animation (9 of Unity3D development), spriteunity3d
Monkey original, reprinted. Reprinted Please note:Reposted from Cocos2D Development Network-cocos2dev.com. Thank you!
Original article address:Http://www.cocos2dev.com /? P = 575
Today, I saw a very simple swing animation. It feels good. Record, which can be used later. It is mainly used to calculate the position.
DropShadowAnim. cs
Using UnityEngine; using System. collections; public class DropShadowAnim: MonoBehaviour {public float radius = 0.15f; // the radius of the shadow from the parent to public float maxAngle = 45.0f; // maximum angle of shadow swing between left and right public float period = 2.0f; // how many seconds does one swing take private Transform trans; void Start () {trans = this. transform;} void Update () {float phase = Time. realtimeSinceStartup * (2.0f * Mathf. PI)/period; float angle = Mathf. sin (phase) * (Mathf. deg2Rad * maxAngle); float startX = 0.0f; float startY =-radius; float sinAngle = Mathf. sin (angle); float cosAngle = Mathf. cos (angle); float x = cosAngle * startX-sinAngle * startY; float y = sinAngle * startX + cosAngle * startY; trans. localPosition = new Vector3 (x, y, 0.0f );}}
It is very easy to use.
1. Create a Sprite as a parent;
2. Copy the created Sprite. Drag to Step 1 as its sub-object.
3. Change the sprite Renderer Color in step 2 to black as the shadow.
4. Add an animation script to Sprite in step 2.
OK. This is done.
Does the bxf skeleton animation not contain a model? Do I need to add another model in unity3D?
Is it fbx ?! Yes. You can place the texture in the same path ~ Materials are automatically generated when used, but the number of playback frames must be set for the animation ~
Learning computer is the largest unity3d training, unity development, unity training base? Have that big name
If you have a program foundation, you might as well learn it by yourself. If you have the necessary skills, you can find a company for an internship.