Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Animation effect to object through script

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 403
    Comment on it

    Add a animation effect to your game object through simple line code in unity

    Add this line to your script update funtion and the object in which this script is added will show you a rotating animation at its position

    void Update () {
            transform.Rotate(new Vector3(15,30,45) * Time.deltaTime);
        }

     

    Another one is changing the angular velocity of object

    Here we will use Random.insideUnitSphere which return random point  

     void Start ()
        {
             rock = GetComponent<Rigidbody>();
            rock .angularVelocity = Random.insideUnitSphere * 5;
    
       }

     

    Through this code your object will show you a rotating effect and its look like your object is animating

    Try this and have fun

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: