Page 1 of 1

How do you use the component class

Posted: 13.07.2012, 21:45
by scoopey
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

Re: How do you use the component class

Posted: 14.07.2012, 12:30
by selden
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.

Re: How do you use the component class

Posted: 14.07.2012, 13:07
by scoopey
Thanks for that!
Worked a treat