スクリプトであるオブジェクトの子にするスクリプトです
using UnityEngine;
using System.Collections;
public class test2 : MonoBehaviour {
public GameObject maru1 ;//親のオブジェクトをアサインする
public GameObject entyu;//子のオブジェクトをアサインする
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public void oyako(){
entyu.transform.parent = maru1.transform;//entyuの親はmaruです
entyu.transform.position = maru1. transform.position;
entyu.transform.rotation = maru1.transform.rotation;
//entyu.transform.position = new Vector3 (2, 2, 2);//これは移動
entyu.transform.rotation = new Quaternion(10, 10, 5, 4);//これは回転
}
}