Billboard Objects, again

A billboard object is something that always points towards the viewer.  These are common in FlightGear but have no apparent equivalent in X-Plane. Here is my way of getting them to work.


 There are two separate objects here - one for internal and one for external views (each called "mainScreen"). For internal, you need to allow for the viewpoint plus the heading of the aircraft. Externally, the aircraft heading does not matter. The hide animations switch between the two versions.

This is the hierarchy in the AC3D source for the model. Anything hidden/locked does not get exported to the X-Plane .obj format model file.

Here is another version to show the seaparate animations. The left-hand palm tree is set for permanent view with the EXTernal animations. ( only sim/graphics/view/pilots_head_psi ) The right-hand palm tree is set for permanent view with the INTernal animations. ( sim/graphics/view/pilots_head_psi plus sim/flightmodel/position/mag_psi ) The central one switches automatically (same as the original version shown above).



Neither version works for all occasions. There may well be a neater way of doing this but I stopped working on it when it met the spec.

Note that pilots_head_psi has a different meaning/value depending on whether you are on internal or external view. Here we have an aircraft on a heading of 200 pointing at the billboard object. In internal view, pilots_head_psi indicates the offset from the aircraft heading (zero). 


But in external view pilots_head_psi indicates the offset from north (-160 !!). 


In both cases, we want the billboard to point at 200 minus 180 = 20 degrees so that it points at the viewer. 
 
Carrying on . . . with the external view first, because it is the easiest: This animation inverts the viewpoint (pilots_head_psi)
ANIM_rotate 0.000000 1.000000 0.000000 90.000000 -90.000000 -90.000000 90.000000 sim/graphics/view/pilots_head_psi
so -160 becomes 020 deg and all is well. But it isn't going to work for the internal view. For much of the time pilots_head_psi will be zero, or close to that, so the billboard would mostly be facing south-ish. 

For that we have: 
ANIM_rotate 0.000000 1.000000 0.000000 90.000000 -90.000000 -90.000000 90.000000 sim/flightmodel/position/mag_psi
which inverts the aircraft heading, so 200 becomes 020 deg and the next animation
ANIM_rotate 0.000000 1.000000 0.000000 90.000000 -90.000000 -90.000000 90.000000 sim/graphics/view/pilots_head_psi

then applies a correction, depending on whether the pilot is looking left or right of the aircraft heading.

Example applications, include: rock formations, custom landing zones and for if you want to do a bit of a cheat with taxiway signs at an airport.







Comments

Popular posts from this blog

Aérospatiale Alouette III released

Chinook Animated