我正在尝试将正在产卵的产卵点锚定到固定位置。因为它们跟随相机的运动,但它们不应该。
我尝试在脚本中创建referencePoint
,它将spawnPoints放置在正确的位置,但是船和spawnPoints
仍沿摄像机运动。是的,我将spawnPoints
都作为referencePoint
的子代。
pos = cannon.transform.position; //same position and rotation as trackedImage
rot = cannon.transform.rotation;
Pose pose = new Pose(pos, rot);
refPoint = aRReferencePointManager.AddReferencePoint(pose);
refPoint.transform.position = new Vector3(pos.x - 2, pos.y + yValueChange, pos.z + 50);
foreach (Boat go in battleshipsGameScript.spawnedBoatList)//each boat added as child of refpoint
{
//go.gameObject.transform.SetParent(refPoint.transform);
//go.gameObject.transform.localPosition = new Vector3(0f, 0f, 0f);
}
battleshipsGameScript.spawnPoints[0].transform.SetParent(refPoint.transform);
battleshipsGameScript.spawnPoints[1].transform.SetParent(refPoint.transform);
此外,当我取消注释go.gameobject
行时,船将以0,0,0
的位置产卵。整个过程开始出现故障。