using UnityEngine;
using System.Collections;

public class JellyCube : MonoBehaviour {

	[SerializeField]
	SpringJoint[] springJoints;

	[SerializeField]
	float spring = 1000;
	[SerializeField]
	float damper = 1;

	// Use this for initialization
	void Start () 
	{
		if (springJoints.Length == 0) {
			springJoints = GetComponentsInChildren<SpringJoint> ();
		}
		Reset();
	}

	void Reset(){

		foreach (SpringJoint sj in springJoints) {
			sj.spring = spring;
			sj.damper = damper;
		}
	}

	// Update is called once per frame
	void FixedUpdate () 
	{
		foreach (SpringJoint sj in springJoints) {
			sj.transform.localRotation = Quaternion.identity;
		}
	}
}
