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

public class WallScript : MonoBehaviour {

    Transform prevtrans;

	// Use this for initialization
	void Awake () {
        GetComponent<Rigidbody2D>().gravityScale = 0;

        SpringJoint2D dj2d = gameObject.AddComponent<SpringJoint2D>();
        dj2d.connectedAnchor = transform.position;
      
        /*prevtrans = new GameObject().transform;
        prevtrans.position = transform.parent.transform.position;
        prevtrans.rotation = transform.parent.transform.rotation;
        prevtrans.localRotation = transform.parent.transform.localRotation;*/
    }

    private void Update()
    {
        /*if (transform.parent.transform.position != prevtrans.position ||
            transform.parent.transform.rotation != prevtrans.rotation ||
            transform.parent.transform.localRotation != prevtrans.localRotation)
        {
            SpringJoint2D dj2d = gameObject.AddComponent<SpringJoint2D>();
            dj2d.connectedAnchor = transform.parent.TransformPoint(prevtrans.InverseTransformPoint(transform.position));
            prevtrans.position = transform.parent.transform.position;
            prevtrans.rotation = transform.parent.transform.rotation;
            prevtrans.localRotation = transform.parent.transform.localRotation;
        }*/
    }
}
