Unity Community


Results 1 to 2 of 2

  1. Location
    Camaiore, Italy
    Posts
    225

    Shake an object from script

    There's someone who can help me shaking an object using script?


  2. Posts
    765
    Code:  
    1. var speed = 1.0f; //how fast it shakes
    2. var amount = 1.0f; //how much it shakes
    3.  
    4. function Update()
    5. {
    6.   transform.position.x = Mathf.Sin(Time.time * speed);
    7. }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •