public static GameObject SetRawImage(RawImage rawImage, int wingModelId) { RenderTexture renderTexture = null; RTManager.CreateRenderTexture(ref renderTexture, "temp_render_texture"); rawImage.GetComponent <RectTransform>().set_sizeDelta(new Vector2((float)renderTexture.get_width(), (float)renderTexture.get_height())); RTManager.SetRT(rawImage, renderTexture); Camera camera = WingGlobal.CreateCameraToModel(renderTexture); ActorModel model = WingGlobal.GetModel(wingModelId); WingGlobal.cameras.Add(camera.get_gameObject()); WingGlobal.models.Add(model.get_gameObject()); camera.get_transform().set_rotation(model.get_transform().get_rotation() * Quaternion.AngleAxis(180f, Vector3.get_up())); Vector3 vector = model.get_transform().get_up() * 0.9f; Vector3 vector2 = model.get_transform().get_forward() * 2.95f; camera.get_transform().set_position(model.get_transform().get_position() + vector + vector2); return(model.get_gameObject()); }
public static ActorModel SetRawImage(RawImage rawImage, int modelId, Vector2 offsetlocalPos, ref GameObject goModel, ref GameObject goCamera) { AvatarModel avatarModel = DataReader <AvatarModel> .Get(modelId); if (avatarModel == null) { return(null); } RenderTexture renderTexture = null; RTManager.CreateRenderTexture(ref renderTexture, "temp_render_texture"); rawImage.GetComponent <RectTransform>().set_sizeDelta(new Vector2((float)renderTexture.get_width(), (float)renderTexture.get_height())); RTManager.SetRT(rawImage, renderTexture); ActorModel actorModel = ModelDisplayManager.Instance.JustCreateUIModel(0, modelId, avatarModel, true, "CameraRange", offsetlocalPos); Camera camera = ModelDisplayManager.CreateCameraToModel(renderTexture); ModelDisplayManager.CameraSettingOfActorModel(camera, avatarModel, offsetlocalPos.x); goModel = actorModel.get_gameObject(); goCamera = camera.get_gameObject(); return(actorModel); }
public List <GameObject> SetModelData(RawImage rawImage, ExteriorArithmeticUnit exteriorUnit, out int index) { List <GameObject> list = new List <GameObject>(); index = this.BorrowModelIndex(); RenderTexture renderTexture = null; RTManager.CreateRenderTexture(ref renderTexture, "temp_render_texture"); rawImage.GetComponent <RectTransform>().set_sizeDelta(new Vector2((float)renderTexture.get_width(), (float)renderTexture.get_height())); RTManager.SetRT(rawImage, renderTexture); Camera camera = this.CreateModelCamera(renderTexture); list.Add(camera.get_gameObject()); ActorModel model = this.GetModel(index, exteriorUnit); list.Add(model.get_gameObject()); camera.get_transform().set_rotation(model.get_transform().get_rotation() * Quaternion.AngleAxis(180f, Vector3.get_up())); Vector3 vector = model.get_transform().get_up() * 0.9f; Vector3 vector2 = model.get_transform().get_forward() * 2.95f; camera.get_transform().set_position(model.get_transform().get_position() + vector + vector2); return(list); }