I have my new Drydock addon finished, except I would like to know is there a way to change between 2 models so an observer can see the difference.
Example pics-
Thanks,
Tim
Scripting to change models
Re: Scripting to change models
Hi,
I suggest having the two versions of your spacecraft in your stc file.
First and default version with the declaration
Visible true
and the second version with the declaration
Visible false
This way only one is visible at the same time.
Now a simple script can switch the visibility of the two objects.
This relies on the object methods visible() and setvisible() available for celestia version 1.6 and later.
for example:
I suggest having the two versions of your spacecraft in your stc file.
First and default version with the declaration
Visible true
and the second version with the declaration
Visible false
This way only one is visible at the same time.
Now a simple script can switch the visibility of the two objects.
This relies on the object methods visible() and setvisible() available for celestia version 1.6 and later.
for example:
Code: Select all
spacecraft1=celestia:find("Sol/Earth/Spacedock/USS Enterprise")
spacecraft2=celestia:find("Sol/Earth/Spacedock/USS Enterprise2")
spacecraft1:setvisible(not spacecraft1:visible())
spacecraft2:setvisible(not spacecraft2:visible())
-
Topic authorfungun
- Posts: 315
- Joined: 30.07.2007
- Age: 63
- With us: 17 years 6 months
- Location: Iowa, USA
Re: Scripting to change models
Thanks, jogad. It works perfect.
Now if I could just figure out how to assign a keystroke to run it.
Tim
Now if I could just figure out how to assign a keystroke to run it.
Tim
Re: Scripting to change models
fungun wrote:Now if I could just figure out how to assign a keystroke to run it. Tim
This time, it is less easy.
Have a look at the celestia:registereventhandler() method.
You will find an example here:
http://en.wikibooks.org/wiki/Celestia/C ... enthandler