private void StartPreviewRender() { if (_renderCamera != null) { Destroy(_renderCamera); } // create and position camera _renderCamera = Instantiate(_previewRenderer); _renderCamera.transform.position = _defaultCameraPosition; // set object to render in camera Camera cam = _renderCamera.GetComponentInChildren <Camera>(); cam.targetTexture = _renderTexture; for (int i = 0; i < _roomObjects.Fixtures.Count; i++) { GameObject model = Instantiate(_roomObjects.Fixtures[i].GetPrefab3d(), _renderCamera.transform.GetChild(0)); model.layer = _renderLayer; foreach (var child in model.GetComponentsInChildren(typeof(Transform), true)) { child.gameObject.layer = _renderLayer; } if (_roomObjects.Fixtures[i].IsOfType("Hideable")) { AddTransparency(model); } model.transform.localScale = _roomObjects.ScaleAt(i); model.transform.localPosition = _roomObjects.PosAt(i); model.transform.localEulerAngles = _roomObjects.RotAt(i); _previewObjects.Add(model); } UpdateCameraView(); }
private void CreateRoomTemplate() { FixtureContainerSO statics = _settingsSO.StaticFixtureSOList; List <FixtureSO> prefabs = statics.Fixtures; _roomTemplate = new GameObject("RoomTemplate"); for (int i = 0; i < prefabs.Count; i++) { GameObject fixture = Instantiate(prefabs[i].GetPrefab3d(), _roomTemplate.transform); fixture.transform.localScale = statics.ScaleAt(i); fixture.transform.localPosition = statics.PosAt(i); fixture.transform.localEulerAngles = statics.RotAt(i); Fixture fixtureScript = fixture.AddComponent <Fixture>(); fixtureScript.FixtureSO = prefabs[i]; } _roomTemplate.SetActive(false); }
private void UpdatePos(int index) { _objectList[index].transform.localPosition = _roomObjects.PosAt(index); }