Transform.TransformPoint()

作者:追风剑情 发布于:2016-11-9 20:53 分类:Unity3d

using UnityEngine;
using System.Collections;

public class Test : MonoBehaviour {

    public GameObject someObject;
    public void Awake()
    {
        //在当前对象(transform)的右边实例化一个物体(someObject)
        Vector3 thePosition = transform.TransformPoint(Vector3.right * 2);//返回世界坐标
        Instantiate(someObject, thePosition, someObject.transform.rotation);
    }
}

标签: Unity3d

Powered by emlog  蜀ICP备18021003号   sitemap

川公网安备 51019002001593号