Board index FlightGear Development Scenery

Local properties for scenery models ?

Questions and discussion about enhancing and populating the FlightGear world.

Local properties for scenery models ?

Postby TheEagle » Thu Oct 21, 2021 7:16 pm

I am implementing boats bobbing on the water based on a property that is set from a Nasal <load> timer. But as they all share the same property, they bob synchronously ! :shock: :roll: How can I avoid this ? Using a relative property path did not help.

I have looked through the code of the interactive jetways, which do not all extend when I click one, and was very astonished to see that they too share one property ! How does it come this works for the jetways, but not for the boats ?

Here are the relevant parts of the boat's XML file:
Code: Select all
<PropertyList>
   <path>SailBoat_38feet.ac</path>
       
   <animation>
      <type>rotate</type>
      <property>sim/scenery/boats/osc-pos-norm</property>
      <factor>5</factor>
      <center>
         <x-m>0</x-m>
         <y-m>0</y-m>
         <z-m>0</z-m>
      </center>
      <axis>
         <x>0</x>
         <y>1</y>
         <z>0</z>
      </axis>
   </animation>
   
   <nasal>
      <load><![CDATA[
         setprop("sim/scenery/boats/osc-pos-norm", 0);
         var update = func() {
            var currentOscPos = getprop("sim/scenery/boats/osc-pos-norm");
            if (currentOscPos > 0) {
               interpolate("sim/scenery/boats/osc-pos-norm", -1, 5);
            } else {
               interpolate("sim/scenery/boats/osc-pos-norm", 1, 5);
            }
         }
         
         oscTimer = maketimer(5, update);
         oscTimer.singleShot = 0;
         oscTimer.simulatedTime = 1;
         oscTimer.start();
      ]]></load>
      <unload><![CDATA[
         oscTimer.stop();
      ]]></unload>
   </nasal>
</PropertyList>

(I know it is buggy, it's the result of 15 minutes)
Cessna 210 (Wiki)
My other aircraft: my wiki profile !
Other: FGTools (GitHub)
World tour: View on SkyVector
Please consider donating $1 / €1 to help me finance a new camera !
User avatar
TheEagle
 
Posts: 3411
Joined: Sat May 01, 2021 3:27 pm
Location: France
Pronouns: You, he
Callsign: F-EAGLE
IRC name: none
Version: Git next
OS: Ubuntu Studio 22.04

Re: Local properties for scenery models ?

Postby TheEagle » Thu Oct 21, 2021 11:44 pm

Actually I just found out that the jetways do not move independently. So isn't this possible at all ?
Cessna 210 (Wiki)
My other aircraft: my wiki profile !
Other: FGTools (GitHub)
World tour: View on SkyVector
Please consider donating $1 / €1 to help me finance a new camera !
User avatar
TheEagle
 
Posts: 3411
Joined: Sat May 01, 2021 3:27 pm
Location: France
Pronouns: You, he
Callsign: F-EAGLE
IRC name: none
Version: Git next
OS: Ubuntu Studio 22.04

Re: Local properties for scenery models ?

Postby merspieler » Fri Oct 22, 2021 8:42 am

There are two different types of models... there are those which move together and there are those which are placed using the jeyways.xml files and move independently and also go to the right position at the aircraft (incontrast to the others which just move a bit without any logic to where they go)
Nia (you&, she/her)

Please use gender neutral terms when referring to a group of people!

Be the change you wish to see in the world, be an ally to all!

Join the official matrix space
merspieler
 
Posts: 2242
Joined: Thu Oct 26, 2017 11:43 am
Location: Wish to be in YBCS
Pronouns: you&, she/her
Callsign: you&, she/her
IRC name: merspieler
Version: next
OS: NixOS

Re: Local properties for scenery models ?

Postby SurferTim » Fri Oct 22, 2021 2:29 pm

The "flock of birds" I see in the Caribbean use multiple images to create the illusion of wing flapping. That way they are not all synchronous.
Fly low. Fly slow. Land on a dime. Twin Otter. https://github.com/SurferTim/dhc6p
My other aircraft is a Citation-X https://github.com/SurferTim/CitationX
PirateAir videos at https://www.youtube.com/user/SurferTim850
User avatar
SurferTim
 
Posts: 1711
Joined: Sun Dec 09, 2018 6:49 pm
Location: Miramar Beach, FL
Callsign: Pirate
Version: 2020.4.0
OS: Ubuntu 18.04

Re: Local properties for scenery models ?

Postby TheEagle » Fri Oct 22, 2021 2:51 pm

I've looked at the birdswarm model - they use a timed animation which selects either the bird with wings up or with wings down. One could use the timed animation to switch between multiple models, too - but to create a halfway smooth bobbing, one would have to copy the object a hundred times, and add hundred branch-durations in the XML file. this works for birds, but sadly not for boats.

Another option would be to have a random offset in the rotate animation - is this possible ?
Cessna 210 (Wiki)
My other aircraft: my wiki profile !
Other: FGTools (GitHub)
World tour: View on SkyVector
Please consider donating $1 / €1 to help me finance a new camera !
User avatar
TheEagle
 
Posts: 3411
Joined: Sat May 01, 2021 3:27 pm
Location: France
Pronouns: You, he
Callsign: F-EAGLE
IRC name: none
Version: Git next
OS: Ubuntu Studio 22.04

Re: Local properties for scenery models ?

Postby SurferTim » Fri Oct 22, 2021 3:03 pm

Have you tried multiple timers? Have 3 or 4 models that start at different positions.
Just a thought...

Edit: You probably want separate models and timers anyway. If you are not a sailor, a 38' boat normally rocks a bit more than a 64' boat.
Fly low. Fly slow. Land on a dime. Twin Otter. https://github.com/SurferTim/dhc6p
My other aircraft is a Citation-X https://github.com/SurferTim/CitationX
PirateAir videos at https://www.youtube.com/user/SurferTim850
User avatar
SurferTim
 
Posts: 1711
Joined: Sun Dec 09, 2018 6:49 pm
Location: Miramar Beach, FL
Callsign: Pirate
Version: 2020.4.0
OS: Ubuntu 18.04

Re: Local properties for scenery models ?

Postby TheEagle » Fri Oct 22, 2021 4:01 pm

Yes, of course - as the different boats have separate XML files anyways, pasting in the Nasal snippet and changing a few numbers won't be the problem.
Cessna 210 (Wiki)
My other aircraft: my wiki profile !
Other: FGTools (GitHub)
World tour: View on SkyVector
Please consider donating $1 / €1 to help me finance a new camera !
User avatar
TheEagle
 
Posts: 3411
Joined: Sat May 01, 2021 3:27 pm
Location: France
Pronouns: You, he
Callsign: F-EAGLE
IRC name: none
Version: Git next
OS: Ubuntu Studio 22.04

Re: Local properties for scenery models ?

Postby SurferTim » Fri Oct 22, 2021 4:04 pm

I'd like to see how that turns out. :)
Fly low. Fly slow. Land on a dime. Twin Otter. https://github.com/SurferTim/dhc6p
My other aircraft is a Citation-X https://github.com/SurferTim/CitationX
PirateAir videos at https://www.youtube.com/user/SurferTim850
User avatar
SurferTim
 
Posts: 1711
Joined: Sun Dec 09, 2018 6:49 pm
Location: Miramar Beach, FL
Callsign: Pirate
Version: 2020.4.0
OS: Ubuntu 18.04

Re: Local properties for scenery models ?

Postby TheEagle » Fri Oct 22, 2021 4:20 pm

Yeah. But they will all bob synced unless I can have a property for each separate model … :(
If I can't, we will have to make 10 variants of each boat model, each with a different offset … But that way, all boats in the scenery database would have to be replaced. Would be better if we could just replace the ~10 models and use some randomness …
Cessna 210 (Wiki)
My other aircraft: my wiki profile !
Other: FGTools (GitHub)
World tour: View on SkyVector
Please consider donating $1 / €1 to help me finance a new camera !
User avatar
TheEagle
 
Posts: 3411
Joined: Sat May 01, 2021 3:27 pm
Location: France
Pronouns: You, he
Callsign: F-EAGLE
IRC name: none
Version: Git next
OS: Ubuntu Studio 22.04

Re: Local properties for scenery models ?

Postby SurferTim » Fri Oct 22, 2021 4:25 pm

If you are speaking of an anchorage, then most 38' boats will be in sync but out of phase, depending on their distance from the beach. Boats anchored further out will get the wave first, then the wave works its way to the beach.

The 64' boats will also be in sync, but out of phase the same way.

Edit: Wave patterns in an anchorage are normally not random.
Fly low. Fly slow. Land on a dime. Twin Otter. https://github.com/SurferTim/dhc6p
My other aircraft is a Citation-X https://github.com/SurferTim/CitationX
PirateAir videos at https://www.youtube.com/user/SurferTim850
User avatar
SurferTim
 
Posts: 1711
Joined: Sun Dec 09, 2018 6:49 pm
Location: Miramar Beach, FL
Callsign: Pirate
Version: 2020.4.0
OS: Ubuntu 18.04

Re: Local properties for scenery models ?

Postby TheEagle » Fri Oct 22, 2021 4:36 pm

I doubt FG boats will be able to simulate that, but it would already be great if they were not moving to the left all at the same time.
Cessna 210 (Wiki)
My other aircraft: my wiki profile !
Other: FGTools (GitHub)
World tour: View on SkyVector
Please consider donating $1 / €1 to help me finance a new camera !
User avatar
TheEagle
 
Posts: 3411
Joined: Sat May 01, 2021 3:27 pm
Location: France
Pronouns: You, he
Callsign: F-EAGLE
IRC name: none
Version: Git next
OS: Ubuntu Studio 22.04

Re: Local properties for scenery models ?

Postby SurferTim » Fri Oct 22, 2021 4:45 pm

If that is your case, then the boats are both in sync (same frequency) and in phase (same phase).
Kick one of 'em out of phase by 45 degrees or so, but leave it in sync. Edit: Put it closer to the beach if at anchor.

Do you see what I mean? If you leave them in phase, it looks like a chorus line. All doing the same thing.
If you take them out of phase but leave then in sync, it looks like "The Wave" at a football game.
Fly low. Fly slow. Land on a dime. Twin Otter. https://github.com/SurferTim/dhc6p
My other aircraft is a Citation-X https://github.com/SurferTim/CitationX
PirateAir videos at https://www.youtube.com/user/SurferTim850
User avatar
SurferTim
 
Posts: 1711
Joined: Sun Dec 09, 2018 6:49 pm
Location: Miramar Beach, FL
Callsign: Pirate
Version: 2020.4.0
OS: Ubuntu 18.04

Re: Local properties for scenery models ?

Postby TheEagle » Fri Oct 22, 2021 5:15 pm

Okay, you call it out of phase, I call it out of sync - we obviously both meant the same ! :) Well, that's just what I'm trying.
Cessna 210 (Wiki)
My other aircraft: my wiki profile !
Other: FGTools (GitHub)
World tour: View on SkyVector
Please consider donating $1 / €1 to help me finance a new camera !
User avatar
TheEagle
 
Posts: 3411
Joined: Sat May 01, 2021 3:27 pm
Location: France
Pronouns: You, he
Callsign: F-EAGLE
IRC name: none
Version: Git next
OS: Ubuntu Studio 22.04

Re: Local properties for scenery models ?

Postby TheEagle » Fri Oct 22, 2021 5:16 pm

The easiest would be if the value for the rotate animation could be determined with a line of Nasal without first outputting the value into a property.
Cessna 210 (Wiki)
My other aircraft: my wiki profile !
Other: FGTools (GitHub)
World tour: View on SkyVector
Please consider donating $1 / €1 to help me finance a new camera !
User avatar
TheEagle
 
Posts: 3411
Joined: Sat May 01, 2021 3:27 pm
Location: France
Pronouns: You, he
Callsign: F-EAGLE
IRC name: none
Version: Git next
OS: Ubuntu Studio 22.04

Re: Local properties for scenery models ?

Postby wkitty42 » Fri Oct 22, 2021 9:01 pm

ummm... can you not simply adjust the boat's elevation up and down a foot or so? i mean, IRL they do move at least that much depending on their size but also because that's how much the waves lift and lower them... but FG doesn't have real waves... from the air looking down at the water, moire is applied to make it look like waves...

i think simply running an algorithm that adjusts the boats' elevation would probably work IF the elevation can be adjusted like i'm think of... you'd do it in similar fashion to swapping images but only to the one property... should be able to do it in small increments to make it smooth... not sure how CPU hungry it will be, though...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9148
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Next

Return to Scenery

Who is online

Users browsing this forum: No registered users and 7 guests