using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class WobbleScript : MonoBehaviour {

    Vector3 origpos;
	// Use this for initialization
	void Start () {
        origpos = transform.position;
        GetComponent<Rigidbody2D>().rotation = Random.Range(-180f, 180f);
    }
	
	// Update is called once per frame
	void Update () {
        GetComponent<Rigidbody2D>().AddForce(Random.insideUnitCircle * 50f);
        transform.position = new Vector3(transform.position.x, transform.position.y, 0);
        GetComponent<Rigidbody2D>().angularVelocity += Random.Range(-0.3f, 0.3f);
        Vector3 wannago = (origpos - transform.position).normalized;
        GetComponent<Rigidbody2D>().AddForce(wannago * 50f);
    }
}
