How do you use the component class

Have a question about using Celestia? Check here first for FAQs and helpful advice.
Forum rules
Please help to make this forum more useful by checking the FAQs before posting! Keep it clean, keep it civil, keep it truthful, stay on topic, be responsible, share your knowledge.
Topic author
scoopey
Posts: 10
Joined: 09.07.2012
With us: 12 years 4 months

How do you use the component class

Post #1by scoopey » 13.07.2012, 21:45

Bit confused as to how to use the componet class.

I've split a spacecraft mesh so that its in two pieces, the hull and the running lights/engines, that way I can make the latter light up with "Emmisive true"
I put them in an ssc file together orbiting and rotating at the same rate and I get the result I intended.

However if I make the windows a compont of the spacecraft, I do not need it to rotate or orbit.
No matter which was I go about it I don't see mt oget it to work,

Regards
Steve C

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 2 months
Location: NY, USA

Re: How do you use the component class

Post #2by selden » 14.07.2012, 12:30

Class "component" has no effect on position or orientation. It only affects the visual representation of an object -- the object's albedo and orbit path are not drawn, for example.

To cause object B to be always be at a specific position relative to object A, B must be defined as a "child object" of A in its OrbitFrame and BodyFrame, with fixed position and orientation relative to A.

E.g. something like

Code: Select all

"object A" "Sun/Planet"
{
   Class "spacecraft"
   Radius 1
   Mesh "ship.cmod"
   EllipticalOrbit { Period 1 SemiMajorAxis 10000 }
   Albedo 0.7
}
"object B" "Sun/Planet/object A"
{
   Class "component"
   Radius 1
   Mesh "windows.cmod"
   Emissive true
       OrbitFrame      { BodyFixed     { Center "Sun/Planet/object A" }}
   FixedPosition [0 0 0]

       BodyFrame      { BodyFixed     { Center "Sun/Planet/object A" }}
   FixedRotation {}
}   


I've left out a lot of details. E.g. you'll probably want to use

Code: Select all

NormalizeMesh false
MeshScale 0.001 # 1 3D model unit = 1 meter
or some similar size relationship for your models.
Selden

Topic author
scoopey
Posts: 10
Joined: 09.07.2012
With us: 12 years 4 months

Re: How do you use the component class

Post #3by scoopey » 14.07.2012, 13:07

Thanks for that!
Worked a treat


Return to “Help Central”