Board index FlightGear Development Aircraft

Animation: expression inside scale

Questions and discussion about creating aircraft. Flight dynamics, 3d models, cockpits, systems, animation, textures.

Animation: expression inside scale

Postby Necolatis » Thu Dec 11, 2014 2:42 am

I cannot seem to get expression inside scale to work. This scales to zero all the time it seems:

Any help appreciated.

Code: Select all
<animation>
    <type>scale</type>
    <object-name>LightBeaconGlow</object-name>
    <expression>
      <dif>
        <property>sim/time/sun-angle-rad</property>
        <value>1</value>
      </dif>
    </expression>
    <x-min>0.0</x-min>
    <y-min>0.0</y-min>
    <z-min>0.0</z-min>
    <x-factor>5.00</x-factor>
    <y-factor>5.00</y-factor>
    <z-factor>5.00</z-factor>
  </animation>


System:
Win7, FG 3.3
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Necolatis
 
Posts: 2238
Joined: Mon Oct 29, 2012 1:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2020.3.19
OS: Windows 10

Re: Animation: expression inside scale

Postby onox » Thu Dec 11, 2014 3:05 am

You wrote <dif> instead of <diff>. See if that fixes it.
onox
Retired
 
Posts: 431
Joined: Fri Jun 20, 2014 3:45 pm

Re: Animation: expression inside scale

Postby Necolatis » Thu Dec 11, 2014 3:10 am

It does not help, also the wiki say dif, not diff: http://wiki.flightgear.org/Expressions

Same problem in 3.2, also tried with <difference>.
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Necolatis
 
Posts: 2238
Joined: Mon Oct 29, 2012 1:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2020.3.19
OS: Windows 10

Re: Animation: expression inside scale

Postby Necolatis » Thu Dec 11, 2014 6:41 pm

I just searched through all aircraft in $FGDATA, none seems to be using expressions in animations.

I have made a bug-report: https://code.google.com/p/flightgear-bu ... il?id=1619
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Necolatis
 
Posts: 2238
Joined: Mon Oct 29, 2012 1:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2020.3.19
OS: Windows 10

Re: Animation: expression inside scale

Postby Thorsten » Thu Dec 11, 2014 7:41 pm

Not sure this is intended to be supported everywhere - but you sure could make a property rule which computes whatever you need to a second property and use that in the animation.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Animation: expression inside scale

Postby Necolatis » Thu Dec 11, 2014 10:09 pm

I got a reply to the bugreport, which solves it:

You must supply a <property> entry for scale, given that your <property> is not defined it's not surprising you get a 0 scaled result.
You can use your expression in the <factor> or <offset> inputs.

Documentation in $FG_ROOT/Docs/model-howto.html#scale is pretty clear about this.

If you don't need to apply different factors/offsets on the axes you can use <factor>/<offset>.
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Necolatis
 
Posts: 2238
Joined: Mon Oct 29, 2012 1:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2020.3.19
OS: Windows 10

Re: Animation: expression inside scale

Postby Necolatis » Thu Dec 11, 2014 10:59 pm

Updated the wiki to reflect this.
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Necolatis
 
Posts: 2238
Joined: Mon Oct 29, 2012 1:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2020.3.19
OS: Windows 10

Re: Animation: expression inside scale

Postby Johan G » Fri Dec 12, 2014 10:48 am

I wonder if that applies to using expressions in the other types of animations as well?

Too bad that it seems that the use of <property> is explicit in model-howto.html, but that you have to use any expression in either or both of <factor> and <offset> is implicit. Sometimes it is a good idea to explain the "obvious", as it may not be that to someone else. (In fact for FG 3.0.0 "expression" is only mentioned in relation to the <condition> tag, in essence for boolean expressions, and there is no separate document on expressions.)
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Some YouTube videos
Johan G
Moderator
 
Posts: 6634
Joined: Fri Aug 06, 2010 6:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.4
OS: Windows 10, 64 bit

Re: Animation: expression inside scale

Postby Necolatis » Fri Dec 12, 2014 12:13 pm

Actually I tested expressions inside offset, could not get it to work.

I am not convinced expressions inside animations, is not broken.
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Necolatis
 
Posts: 2238
Joined: Mon Oct 29, 2012 1:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2020.3.19
OS: Windows 10

Re: Animation: expression inside scale

Postby fursanton » Thu Feb 23, 2017 4:31 pm

also need mention that you can't use <factor> and <offset> if you're using <expression>. You should use <product> and <sum> elements inside <expression> tag.
fursanton
 
Posts: 2
Joined: Thu Feb 16, 2017 9:06 pm

Re: Animation: expression inside scale

Postby Octal450 » Thu Feb 23, 2017 6:28 pm

Three years later ;)
Skillset: JSBsim Flight Dynamics, Systems, Canvas, Autoflight/Control, Instrumentation, Animations
Aircraft: A320-family, MD-11, MD-80, Contribs in a few others

Octal450's GitHub|Launcher Catalog
|Airbus Dev Discord|Octal450 Hangar Dev Discord
User avatar
Octal450
 
Posts: 5601
Joined: Tue Oct 06, 2015 1:51 pm
Location: Huntsville, AL
Callsign: WTF411
Version: next
OS: Windows 11

Re: Animation: expression inside scale

Postby mhab » Thu Jun 29, 2017 1:21 pm

I try to add a similar question as I can't seem to get <expression> to work within scale animation ...

I want to shrink the object in z direction depending on the location of the elevator.
If I try the following it basically works
Code: Select all
  <animation>
    <type>scale</type>
    <object-name>elev-4-wires</object-name>
    <property>surface-positions/elevator[3]/position-norm</property>
    <center>
      <x-m> 0.00</x-m>
      <y-m> 0.00</y-m>
      <z-m>19.00</z-m>
    </center>
    <x-min>1.0</x-min>
    <y-min>1.0</y-min>
    <z-min>0.1</z-min>
    <x-factor>1.0</x-factor>
    <y-factor>1.0</y-factor>
    <z-factor>1.0</z-factor>
  </animation>

Problem is: I need to invert the scaling so it follows 1-"the-property-used".

I tried the following without success:
Code: Select all
  <animation>
    <type>scale</type>
    <object-name>elev-4-wires</object-name>
    <property>surface-positions/elevator[3]/position-norm</property>
    <center>
      <x-m> 0.00</x-m>
      <y-m> 0.00</y-m>
      <z-m>19.00</z-m>
    </center>
    <x-min>1.0</x-min>
    <y-min>1.0</y-min>
    <z-min>0.1</z-min>
    <x-factor>1.0</x-factor>
    <y-factor>1.0</y-factor>
    <z-factor>
      <expression>
        <dif>
          <value>1.0</value>
          <property>surface-positions/elevator[3]/position-norm</property>
        </dif>
      </expression>
     </z-factor>
  </animation>


The Wiki and all other mentioned sources of information are not really helpful for me yet ...

Any advice ?
Mike-DE
mhab
 
Posts: 418
Joined: Thu Apr 18, 2013 11:59 pm
Callsign: D-MIKE
Version: 2020.3.4
OS: Win10

Re: Animation: expression inside scale

Postby Octal450 » Thu Jun 29, 2017 1:25 pm

Put this expression in a gain filter with a gain of 1, then use the output for the property.
See PropertyRules on the wiki.

Kind Regards,
Josh
Skillset: JSBsim Flight Dynamics, Systems, Canvas, Autoflight/Control, Instrumentation, Animations
Aircraft: A320-family, MD-11, MD-80, Contribs in a few others

Octal450's GitHub|Launcher Catalog
|Airbus Dev Discord|Octal450 Hangar Dev Discord
User avatar
Octal450
 
Posts: 5601
Joined: Tue Oct 06, 2015 1:51 pm
Location: Huntsville, AL
Callsign: WTF411
Version: next
OS: Windows 11

Re: Animation: expression inside scale

Postby mhab » Thu Jun 29, 2017 3:37 pm

Thanks for the hint.

Considering all this, and the fact that I am using this for a carrier, which in turn is used as an AI model, I handle a new property in the Nasal main-loop of the carrier.
It works now as desired and adds a nice feature. The carrier elevators on the new Truman carrier do not work in "free fall manner" but have wires which follow the movement of the carrier.

Mike-DE
mhab
 
Posts: 418
Joined: Thu Apr 18, 2013 11:59 pm
Callsign: D-MIKE
Version: 2020.3.4
OS: Win10

Re: Animation: expression inside scale

Postby Octal450 » Thu Jun 29, 2017 7:20 pm

Welcome, anytime.

Kind Regards,
Josh
Skillset: JSBsim Flight Dynamics, Systems, Canvas, Autoflight/Control, Instrumentation, Animations
Aircraft: A320-family, MD-11, MD-80, Contribs in a few others

Octal450's GitHub|Launcher Catalog
|Airbus Dev Discord|Octal450 Hangar Dev Discord
User avatar
Octal450
 
Posts: 5601
Joined: Tue Oct 06, 2015 1:51 pm
Location: Huntsville, AL
Callsign: WTF411
Version: next
OS: Windows 11

Next

Return to Aircraft

Who is online

Users browsing this forum: No registered users and 12 guests