关于子物体在世界坐标中的移动

移动球体到黑色方块位置。球体为白色方块的子物体的子物体

public GameObject target;
	// Use this for initialization
	void Start () {
        Vector3 world = target.transform.TransformPoint(this.transform.position);
         this.transform.position=   this.transform.InverseTransformPoint(world);
	}

猜你喜欢

转载自blog.csdn.net/lvcoc/article/details/85100519
今日推荐