I am working on making a vessel that can provide a visual wind indication when atmospheric wind effects are turned on, in the manner of a wind sock on a small airfield. What could go wrong?
So I made a simple mesh of a flag and animated it.
The intent was that this would remain stationary and the flag would rotate via animation to align with the wind direction.
First trick was to make a vessel, and get it out of inactive / landed status. So I set contact points and gave it a nominal mass, and I "bump" it with a small add_force force on the first time step. This was necessary to get vi:airspeed() and vi:airspeedvector() to return anything, as landed vessels don't interact with the wind.
Second problem (very possibly an Orbiter bug?) - once I got it out of the landed state, the flag started getting blown away by the wind! There was a drag force acting on the vessel even though there were absolutely no drag elements applied to it!


I have no idea why this occurs and will submit it as an issue to Github.
So, in order to patch that problem and keep the flag stationary, I used add_force to oppose and neutralize the drag force, and set the angular velocity to 0 to keep it from rotating:
This kinda-sorta worked, but the flag would still move about randomly, but usually randomly around its original point. You can see that the drag forces are not trivial (flag alignment animation is not set yet in this image):

But once in a while it would be at a velocity close enough to 0 where it would resume inactive/landed status again!:
So, to work around this issue, I tested to see if the vessel was landed, and if so I re-bumped it to get it out of inactive landing status:
It seems that every time the flag needs a "bump" the forces become unbalanced and it drifts with the wind a bit. Again, no drag elements whatsoever are applied to this vessel - no airfoils, no drag coefficients, no variable drag, nothing.
But it 95% works:

It's been running for about 20 minutes and is still not landed, but you can see how far it moves (it started at the end of the runway at the start of the over-run):

So I made a simple mesh of a flag and animated it.
The intent was that this would remain stationary and the flag would rotate via animation to align with the wind direction.
First trick was to make a vessel, and get it out of inactive / landed status. So I set contact points and gave it a nominal mass, and I "bump" it with a small add_force force on the first time step. This was necessary to get vi:airspeed() and vi:airspeedvector() to return anything, as landed vessels don't interact with the wind.
Second problem (very possibly an Orbiter bug?) - once I got it out of the landed state, the flag started getting blown away by the wind! There was a drag force acting on the vessel even though there were absolutely no drag elements applied to it!


I have no idea why this occurs and will submit it as an issue to Github.
So, in order to patch that problem and keep the flag stationary, I used add_force to oppose and neutralize the drag force, and set the angular velocity to 0 to keep it from rotating:
Code:
--shouldn't need the following, but a spurious drag force is applied to the flag when atmospheric wind effects are enabled.
drag = vi:get_dragvector()
vi:add_force(vec.mul(drag,-1), {x=0,y=0,z=0})
vi:set_angvel({x=0,y=0,z=0})
This kinda-sorta worked, but the flag would still move about randomly, but usually randomly around its original point. You can see that the drag forces are not trivial (flag alignment animation is not set yet in this image):

But once in a while it would be at a velocity close enough to 0 where it would resume inactive/landed status again!:
Code:
BEGIN_SHIPS
WindSock:WindSock
STATUS Landed Earth
POS -80.6825845 28.5969059
HEADING 330.18
ALT 0.837
AROT 66.673 33.912 9.869
NAVFREQ 0 0
END
END_SHIPS
So, to work around this issue, I tested to see if the vessel was landed, and if so I re-bumped it to get it out of inactive landing status:
Code:
if simt == simdt or vi:is_landed() ~= nil then --bump vessel to get it out of inactive status
vi:add_force({x=0, y=1e-9, z=0}, {x=0,y=0,z=0})
end
It seems that every time the flag needs a "bump" the forces become unbalanced and it drifts with the wind a bit. Again, no drag elements whatsoever are applied to this vessel - no airfoils, no drag coefficients, no variable drag, nothing.
But it 95% works:

It's been running for about 20 minutes and is still not landed, but you can see how far it moves (it started at the end of the runway at the start of the over-run):

Last edited:

