improve cam update

This commit is contained in:
Beu 2023-09-26 22:13:56 +02:00
parent 03ea64b021
commit a6097ae400

View File

@ -174,10 +174,8 @@ void AddNewObject(const string &in objectname, int trigger, const string &in typ
bool FocusCam(const string &in objectname) { bool FocusCam(const string &in objectname) {
auto editor = cast<CGameCtnEditorFree>(GetApp().Editor); auto editor = cast<CGameCtnEditorFree>(GetApp().Editor);
auto camera = editor.OrbitalCameraControl; auto camera = editor.OrbitalCameraControl;
auto map = GetApp().RootMap;
if (camera !is null) {
if (camera !is null) {
int index = objectsindex.Find(objectname); int index = objectsindex.Find(objectname);
camerafocusindex++; camerafocusindex++;
@ -188,8 +186,11 @@ bool FocusCam(const string &in objectname) {
camera.m_TargetedPosition = objects[index].positions[camerafocusindex]; camera.m_TargetedPosition = objects[index].positions[camerafocusindex];
// Workaround to update camera TargetedPosition // Workaround to update camera TargetedPosition
auto m_ParamScrollZoomPowe = camera.m_ParamScrollZoomPower;
camera.m_ParamScrollZoomPower = 0;
editor.ButtonZoomInOnClick(); editor.ButtonZoomInOnClick();
editor.ButtonZoomOutOnClick(); camera.m_ParamScrollZoomPower = m_ParamScrollZoomPowe;
return true; return true;
} }
return false; return false;