private void LoadCameras() { List <AuroraGIT.ACamera> cameras = git.CameraList; CameraPoint cam; GameObject parent = new GameObject("Cameras"); parent.transform.SetParent(area.transform); foreach (var p in cameras) { loader.AddAction(() => { Vector3 position = new Vector3( p.Position.x, p.Position.z, p.Position.y ); Quaternion rotation = new Quaternion( -p.Orientation.x, -p.Orientation.z, -p.Orientation.y, p.Orientation.w ); cam = CameraPoint.Create(p); cam.gameObject.transform.position = position; cam.gameObject.transform.rotation = rotation; cam.transform.SetParent(parent.transform); cam.transform.name = "Camera_" + p.CameraID; cameraPoints.Add(cam); }); } }
public static CameraPoint Create(AuroraGIT.ACamera acam) { GameObject gameObject; //get the resource reference for this object, which we'll use as it's in-engine name string name = "cam_" + acam.CameraID; //create a new game object and load the model into the scene gameObject = new GameObject(); gameObject.name = name; //add the template component to the new object CameraPoint camera = gameObject.AddComponent <CameraPoint>(); camera.gitData = acam; return(camera); }