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

public class vertexDisplace : MonoBehaviour {
	

	public float sphereVertexSpeed = 1.0f;
	public float sphereVelocityOffset = 0.1f;
	public float boxVertexSpeed = 2.0f;
	public float boxVelocityOffset = 0.1f;

	public Rigidbody rgdbody;

	void Start () {
		rgdbody = GetComponent<Rigidbody> ();
	}
		
	void Update () {
		
	}
	void OnTriggerEnter (Collider collision) {
//		Debug.Log("I hit an object!");
		if (collision.CompareTag("Sphere Collider Expansion")) {
			rgdbody.velocity = new Vector3(0,sphereVertexSpeed / (collision.GetComponent<SphereCollider>().radius + sphereVelocityOffset),0);
		} else if (collision.CompareTag("Box Collider Expansion")) {
			rgdbody.velocity = new Vector3(0,boxVertexSpeed / (collision.GetComponent<BoxCollider>().size.z + boxVelocityOffset),0);
		}
//		float distance = 0.0f;
//		distance = Vector3.Distance(gameObject.transform.position, collision.transform.position);
//		Debug.Log (" Distance is " + distance.ToString());
	}
}
