Jump to content

Archived

This topic is now archived and is closed to further replies.

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?

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

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.

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 New...