场景:
代码内容:
public Camera camera;
public Transform viewPoint;
public GameObject player;
// Use this for initialization
private void LateUpdate()
{
if (player == null)
return;
this.transform.position = player.transform.position;
this.transform.rotation = player.transform.rotation;
}
将代码绑定在空对象MainPlayerCamera物体上,设置的射手位置与MainPlayerCamera物体的物质相同,这时,如果设置子对象也就是有实例的摄像机相对MainPlayerCamera的位置如果是(0,0,0)会出现这样的情况
这不是我们想要的效果,所以此时的子对象相对于parent的位置需要手动调至想要的位置。
分析:跪在这里是因为没有考虑清楚子物体与parent相对位置含义