center() and goto() can't be concurrent?

All about writing scripts for Celestia in Lua and the .cel system
Topic author
rbroberts
Posts: 23
Joined: 05.11.2006
With us: 17 years 10 months
Location: Brooklyn, NY

center() and goto() can't be concurrent?

Post #1by rbroberts » 28.03.2008, 20:01

It would seem that I can't do

Code: Select all

obs:goto(object)
obs:center(other_object)

When I attempt to do so, the goto is interrupted and does not complete. This is celestia 1.5.0. Is this normal behavior? Is there a way to do both at the same time?

What I'm trying to do is smoothly change both my location and my view so that I am in LEO looking at the moon.
Roland B. Roberts, PhD
6818 Madeline Court
Brooklyn, NY 11220

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 8 months
Location: Nancy, France

Re: center() and goto() can't be concurrent?

Post #2by Vincent » 29.03.2008, 08:44

Just add a wait() command after goto() and center():

Code: Select all

obs:goto(object)
wait(5)
obs:center(other_object)
wait(5)
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Topic author
rbroberts
Posts: 23
Joined: 05.11.2006
With us: 17 years 10 months
Location: Brooklyn, NY

Re: center() and goto() can't be concurrent?

Post #3by rbroberts » 31.03.2008, 18:22

Yes, I know about wait. What I'm actually doing right now is

Code: Select all

obs:goto(L1)
while obs:travelling() do
  wait(0.25)
end
obs:center(moon)

but that's not simultaneous which is what I was asking. It would be nice to be able to both move and orient at the same time. I guess I need to post on the feature request board.

roland
Roland B. Roberts, PhD

6818 Madeline Court

Brooklyn, NY 11220

buggs_moran
Posts: 835
Joined: 27.09.2004
With us: 20 years
Location: Massachusetts, USA

Re: center() and goto() can't be concurrent?

Post #4by buggs_moran » 01.04.2008, 01:03

I am actually working on something like that but it is slow going. So far I have the celx turning to the object while moving but I have a ways to go... I will post when I finish.

I also wanted to add to the previous code snippets you guys posted. Instead of using wait, I found the boolean observer:traveling() works well. It returns a "true" if you are, well, traveling... but again that is not simultaneous.
Homebrew:
WinXP Pro SP2
Asus A7N8X-E Deluxe
AMD Athlon XP 3000/333 2.16 GHz
1 GB Crucial RAM
80 GB WD SATA drive
ATI AIW 9600XT 128M

ajtribick
Developer
Posts: 1855
Joined: 11.08.2003
With us: 21 years 1 month

Re: center() and goto() can't be concurrent?

Post #5by ajtribick » 01.04.2008, 12:13

Can't you track the object you want to centre and then do the goto?

Topic author
rbroberts
Posts: 23
Joined: 05.11.2006
With us: 17 years 10 months
Location: Brooklyn, NY

Re: center() and goto() can't be concurrent?

Post #6by rbroberts » 10.04.2008, 00:00

track jumps, center slews gradually. I want the smooth motion effect.

I can, in principle, do this with the long form of goto, but it is a lot more work since you have to use positions instead of objects. And as the manual points out, doing a goto on an object position is not the same as doing a goto on an object.
Roland B. Roberts, PhD

6818 Madeline Court

Brooklyn, NY 11220


Return to “Scripting”