Celestia/Celx Scripting/CELX Lua Methods/CEL command setradius

From Wikibooks, open books for an open world
Jump to navigation Jump to search

setradius[edit | edit source]

setradius { object <name> radius <number> }

Set the new radius of an object.


Arguments:

object <name>
Name of the object of which the radius mus be changed. Must be a string.
radius <number>
The new radius of the object, as a number in kilometers. Default is 1 km !!!


CELX equivalent:

Based on the 1.5.0 object:setradius() method.

  • Find the object with name <name> and store in object
object = celestia:find(<name>)
  • Set the radius of object to <number> km.
object:setradius(<number>)


Summarized:

object = celestia:find(<name>)
object:setradius(<number>)


Example:
Make the radius of the Earth 20 times bigger and then make the radius of the Moon as big as the new radius of Earth.

CEL:

setradius { object "Sol/Earth" radius 127562 }
setradius { object "Sol/Earth/Moon" radius 127562 }

CELX:

object1 = celestia:find("Sol/Earth")
robject1 = object1:radius()
object2 = celestia:find("Sol/Earth/Moon")
object1:setradius(20*robject1)
robject1 = object1:radius()
object2:setradius(robject1)


Back to CEL command index