'lock' 2 objects via .CEL script?

The place to discuss creating, porting and modifying Celestia's source code.
Topic author
don
Posts: 1709
Joined: 12.07.2003
With us: 21 years 4 months
Location: Colorado, USA (7000 ft)

'lock' 2 objects via .CEL script?

Post #1by don » 19.07.2003, 01:56

If someone knows how to lock two objects via .CEL script, could you please show an example?

The lock command doesn't take any arguments, and the select command only takes ONE object argument, so I'm not sure how to do this. The following code locks only Earth ...

Code: Select all

  select { object "Sol"}
  lock {}
  select { object "Earth" }
  lock {}


Thank you!

-Don

Topic author
don
Posts: 1709
Joined: 12.07.2003
With us: 21 years 4 months
Location: Colorado, USA (7000 ft)

Post #2by don » 19.07.2003, 02:01

Also, could someone explain to me exactly what lock does? Yes, I know it "locks" an object or two together, but for what purpose? How does the view change?

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 9 months
Location: Seattle, Washington, USA

Post #3by chris » 19.07.2003, 02:02

The command sequence is the same as if you were using the keyboard:

Code: Select all

select { object "Earth" }
follow {}
select { object "Sol" }
lock {}


This will maintain your position with respect to the center of the Earth, and keep both the Sun and the Earth at a fixed location in your view. It's the same as if you typed 3 f 0 :

--Chris
Last edited by chris on 19.07.2003, 02:36, edited 1 time in total.

Topic author
don
Posts: 1709
Joined: 12.07.2003
With us: 21 years 4 months
Location: Colorado, USA (7000 ft)

Post #4by don » 19.07.2003, 02:23

Hi Chris,

Just tried your code example, and the display says "Lock Earth -" ... no "Sol".

In your keystroke example, I think you forgot the final ":"? It should be "3 f 0 :", right?

Topic author
don
Posts: 1709
Joined: 12.07.2003
With us: 21 years 4 months
Location: Colorado, USA (7000 ft)

Post #5by don » 19.07.2003, 02:24

Oops, you typed "Sun" instead of "Sol" (smile).

Your code example works fine when this change is made.

Thank you!

Topic author
don
Posts: 1709
Joined: 12.07.2003
With us: 21 years 4 months
Location: Colorado, USA (7000 ft)

Post #6by don » 19.07.2003, 03:50

One more question re: lock ...

Would anyone ever want to lock on a single object? If so, for what purpose?

Thanks!

-Don

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 9 months
Location: Seattle, Washington, USA

Post #7by chris » 19.07.2003, 04:02

There's no point . . . If you try and do this, Celestia will force the target body to be the parent star of reference object.

--Chris

Topic author
don
Posts: 1709
Joined: 12.07.2003
With us: 21 years 4 months
Location: Colorado, USA (7000 ft)

Post #8by don » 20.07.2003, 22:01

I agree with "no point".

However, at times, I see the Celestia display show something like "Lock Earth - ", so something is letting it "lock" to a single object, or letting this slip by, or UNlocking the second object for some reason, without also UNlocking the first. Maybe this is desirable?

That's why I asked <smile>.

-Don


Return to “Development”