BTTF

バック・トゥ・ザ・フューチャーでは、今年あたりは車が空を飛んでいました。
飛ばせます。Unityの中なら。

![スクリーンショット 2015-10-22 0.17.16.png](https://qiita-image-store.s3.amazonaws.com/0/59911/baddaf07-b8ef-a496-a0de-b39a5a90527c.png)

大抵の車モデルにはタイヤにTransformが付いていると思うので、
こんな感じで飛ばせるんじゃないかと思います。

```C#:TimeMachiene.cs
using UnityEngine;
using System.Collections;

public class TimeMachiene : MonoBehaviour {
	public Transform m_FrontL;
	public Transform m_FrontR;
	public Transform m_BackL;
	public Transform m_BackR;
	public float m_TransOfsY;
	public Camera m_Camera;
	private GameObject m_pivotL;
	private GameObject m_pivotR;
	private Quaternion m_pivotLToRot;
	private Quaternion m_pivotRToRot;

	private float m_rate=0.01f;
	private Vector3 m_toPos;
	private Quaternion m_toRot;
	private bool m_CamMove;

	// Use this for initialization
	void Start () {
		m_pivotL = new GameObject("pivotL");
		m_pivotL.transform.SetParent(m_FrontL.transform.parent);
		m_pivotL.transform.localPosition = m_FrontL.transform.localPosition - Vector3.left * m_TransOfsY;
		m_FrontL.transform.SetParent(m_pivotL.transform);
		m_BackL.transform.SetParent(m_pivotL.transform);
		m_pivotLToRot = m_pivotL.transform.localRotation * Quaternion.FromToRotation (Vector3.left, Vector3.down);

		m_pivotR = new GameObject("pivotR");
		m_pivotR.transform.SetParent(m_FrontR.transform.parent);
		m_pivotR.transform.position = m_FrontR.transform.position + Vector3.left * m_TransOfsY;
		m_FrontR.transform.SetParent(m_pivotR.transform);
		m_BackR.transform.SetParent(m_pivotR.transform);
		m_pivotRToRot = m_pivotR.transform.localRotation * Quaternion.FromToRotation (Vector3.left, Vector3.up);

		m_toPos = gameObject.transform.position;
		m_toRot = gameObject.transform.rotation;
		StartCoroutine (animCo ());
	}
	
	// Update is called once per frame
	void Update () {
		m_pivotL.transform.localRotation = Quaternion.Lerp (m_pivotL.transform.localRotation, m_pivotLToRot, m_rate);
		m_pivotR.transform.localRotation = Quaternion.Lerp (m_pivotR.transform.localRotation, m_pivotRToRot, m_rate);
		Quaternion camRot = Quaternion.LookRotation (gameObject.transform.position-m_Camera.transform.position);
		gameObject.transform.position = Vector3.Lerp (gameObject.transform.position, m_toPos, m_rate);
		gameObject.transform.rotation = Quaternion.Lerp (gameObject.transform.rotation, m_toRot, m_rate);
		if (m_CamMove) {
			m_Camera.transform.rotation = Quaternion.Lerp(m_Camera.transform.rotation,camRot,m_rate);
		}
	}

	private IEnumerator animCo(){
		m_rate = 0.01f;
		yield return new WaitForSeconds (1f);
		m_toPos += Vector3.up * 0.2f;
		yield return new WaitForSeconds (2f);
		m_rate = 0.005f;
		m_CamMove = true;
		m_toPos += Vector3.up * 1.0f;
		m_toPos -= gameObject.transform.forward * 0.5f;
		m_toRot *= Quaternion.AngleAxis(30f, Vector3.forward);
		yield return new WaitForSeconds (3f);
		m_rate = 0.1f;
		m_toPos += gameObject.transform.forward * 5f;
		m_toRot *= Quaternion.AngleAxis(30f, Vector3.up);
	}
}
```

サンプルでは無料アセットを使用しました。
https://www.assetstore.unity3d.com/jp/#!/content/19264


![スクリーンショット 2015-10-22 0.41.32.png](https://qiita-image-store.s3.amazonaws.com/0/59911/62c5124e-a18d-8857-08d5-6d03d717c1e8.png)

![スクリーンショット 2015-10-22 0.42.27.png](https://qiita-image-store.s3.amazonaws.com/0/59911/eda26c91-6f42-92c4-03c8-096bf9c656b6.png)