I am trying to implement different views for a spacecraft simulator using a LUA script. I managed to create 3 working views all with the same distance between spacecraft and observer. When I tried to create a 4th view with a larger distance it became a mess. I realized that if I centerorbit or lock after a chase/follow the gotodistance command is not applied. The thing is that everything works if I chose manually first one command and then the other one. I tried then to put waits and while(obs:travelling()) to force the same effect but it does not work. It is really strange. Maybe a command cancels another one.
Basically what I want each view to do is to set a chase/synchronous/follow, then maybe lock and centerorbit, and finally increase the observer distance to certain amount. Could you help me please?
this is one of the views that I have. It does not set the distance:
obs:chase(spacecraft)
actual_travel = obs:travelling()
while actual_travel do
actual_travel = obs:travelling()
wait(0.0)
end
obs:gotodistance(spacecraft, 0.1, 0.0)
obs:lock(planet)
obs:centerorbit(planet,0.0)
The gotodistance command only works if is the last one. So, if I remove the last two lines and after setting this view I set another one with only this two commands, it works.
Thank you in advance.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I am trying to implement different views for a spacecraft simulator using a LUA script. I managed to create 3 working views all with the same distance between spacecraft and observer. When I tried to create a 4th view with a larger distance it became a mess. I realized that if I centerorbit or lock after a chase/follow the gotodistance command is not applied. The thing is that everything works if I chose manually first one command and then the other one. I tried then to put waits and while(obs:travelling()) to force the same effect but it does not work. It is really strange. Maybe a command cancels another one.
Basically what I want each view to do is to set a chase/synchronous/follow, then maybe lock and centerorbit, and finally increase the observer distance to certain amount. Could you help me please?
this is one of the views that I have. It does not set the distance:
The gotodistance command only works if is the last one. So, if I remove the last two lines and after setting this view I set another one with only this two commands, it works.
Thank you in advance.