Jump to content
Sign in to follow this  
PlaneEater

Need some XML animation code help (custom modeldef.xml entry)

Recommended Posts

I've got two little bits of custom XML animation tag code that I'm trying to get working and they're driving me crazy.The first one is a simple mechanical angle-of-attack vane mounted on the nose pitot. Originally I had it set up to use the AOA needle code, but it was always parallel to the ground. It should always be pointing in the direction of travel. I've tried to do that using forward and vertical speed to derive a 2D vector and then taking the arctangent and adjusting it to a 0-180 range instead of -90 to 90, but I'm having a heck of a time getting the atg operator to work.The AOA vane object is keyed from 0-180, with 0 straight down and 180 straight up. I'm not worried about the 180 degree arc to the rear, so I just blocked out negative values of horizontal momentum by taking the absolute value (the plane should never be falling or climbing backwards, anyhow). Here's the code I have so far...

<PartInfo>	<Name>needle_pitch_vane</Name>	<AnimLength>180</AnimLength>	<Animation>		<Parameter>			<Code>((A:VELOCITY BODY Y, ft/sec) ((A:VELOCITY BODY Z, ft/sec) abs) /) atg rddg 90 +</Code>		</Parameter>	</Animation>  </PartInfo>

At first I didn't have the rddg (radians to degrees) operator in there, but all the other trig functions output in rads and I'm guessing atg does as well. The problem is I'm guessing it also needs input in radians like the other trig functions, and I need it to give me the arctangent of the slope of the line (vert speed)/(absolute value of(horiz speed)). I don't know quite enough trig to take the two speed vectors and do my computations with a result in radians to make the atg operator happy.The other animation I'm trying to do just needs to take a 100 frame loop and scale up the animation speed based on airspeed, so the faster the aircraft goes, the faster the animation loops. I tried using the fly_wheel animation tag but it doesn't seem to be functional.Any help would be fantastic. Thanks in advance!

Share this post


Link to post
Share on other sites

Might I suggest using INCIDENCE BETA for your angle of attack?


Ed Wilson

Mindstar Aviation
My Playland - I69

Share this post


Link to post
Share on other sites
Might I suggest using INCIDENCE BETA for your angle of attack?
Just checked the SimVar list... do you mean INCIDENCE ALPHA? (INCIDENCE BETA is sideslip) Is that value the actual angle of the airstream over the aircraft, or is it locked parallel to the ground like the needle_AOA variable?

Share this post


Link to post
Share on other sites

Not sure about the syntax in modeldef.xml, but for xml gauges RPN it may have to look like this... ( No ( ) surounding operations )

<PartInfo>	<Name>needle_pitch_vane</Name>	<AnimLength>180</AnimLength>	<Animation>		<Parameter>			<Code>(A:VELOCITY BODY Y, ft/sec) (A:VELOCITY BODY Z, ft/sec) abs / atg rddg 90 +</Code>		</Parameter>	</Animation>  </PartInfo>

" The sum of 90 & the rddg conversion of the arctangent of the division of the absolute of Z and Y (normal) "Roman


20AUG21_Avsim_Sig.png?dl=1  FS RTWR   SHRS F-111   JoinFS   Little Navmap 
 

 

Share this post


Link to post
Share on other sites
Just checked the SimVar list... do you mean INCIDENCE ALPHA? (INCIDENCE BETA is sideslip) Is that value the actual angle of the airstream over the aircraft, or is it locked parallel to the ground like the needle_AOA variable?
ALPHA... BETA... it's all incidental to me. ;)Yes, I meant ALPHA.

Ed Wilson

Mindstar Aviation
My Playland - I69

Share this post


Link to post
Share on other sites
ALPHA... BETA... it's all incidental to me. ;)Yes, I meant ALPHA.
PERFECT! It works! A little twitchy when you first start the flight and you're sitting on the runway, but I'll call that "engine vibration". :DNow I just have to figure out how to tie the speed of that animation loop to airspeed. That one I'm clueless where to start... I can't find any variables anywhere that control framerate or anything like that for a given animation.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...