Skip to content

Instantly share code, notes, and snippets.

@peroon
Last active December 28, 2015 08:16
Show Gist options
  • Select an option

  • Save peroon/e578677bd44b1c01f076 to your computer and use it in GitHub Desktop.

Select an option

Save peroon/e578677bd44b1c01f076 to your computer and use it in GitHub Desktop.
using UnityEngine;
using System.Collections;
// 各インスタンスにAnimatorつけるのがもったいないのでAnimatorつけるのは1つにして
// 他のオブジェクトはそれをコピーする
// 1フレーム遅れるが問題ない
public class AnimationCopy : MonoBehaviour {
public Transform animationBase; // アニメーションのコピー元
void Update () {
// 自身のローカルPos, Rotをコピー元と合わせる
if (animationBase != null) {
this.transform.localPosition = animationBase.localPosition;
this.transform.localRotation = animationBase.localRotation;
} else {
Debug.Log ("null");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment