Howto:Objects visible according to views

From FlightGear wiki
Jump to navigation Jump to search

You may want to make parts of your aircraft only show objects or models in an individual view. Particularly if you want internal and external views, such as a cabin.

The cabin interior is a seperate .ac file. Inside the xml file which refers to that ac file, it has these tags:

 <model>
  <path>models/example.ac</path>
  <offsets>example position coordinates</offsets>
  <condition>
   <equals>
    <property>sim/current-view/internal</property>
    <value type="bool">true</value>
   </equals>
  </condition>
 </model>

Or if you want something to appear from outside only, you change the "true" to "false". The code above goes before you close the models tag, so it refers to that model individually, and none others. (</model>).

I made it so that the plane only appears from outside aswell, but it made everything except the insides disapeear from the inside view, which is bad because you couldnt see the wings out of the windows. So what I then did was made the wings a seperate object in AC3D, and name them "wings" and the fuselage as "fuselage", then in the main A340.xml it refers to that particular object (not the whole .ac file) to disapear or appear depending on the view.

 <!-- Fuselage invisible from internally -->
 
 <animation>
  <type>select</type>
  <object-name>fuselage</object-name>
  <condition>
   <not>
    <property>sim/current-view/internal</property>
   </not>
  </condition>
 </animation>

Thats it!