P3D v4 visibility conditions for scenery objects

tgibson

Resource contributor
I probably missed it, but how is that done? I can't find instructions on that, sorry.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Hi,

Let's me show an example. I have loaded a simple windsock object:

1562005314499.png


Now in the hierarchy editor I select the top node. And in the right pane I right click on transformation and select the add animation:

1562005357174.png


Then right click on the animation that was added and press the edit animation option. In the form that appears In that form you can add the 5 keys that are needed. Each with a rotation around the Z-axis of 0, 90, 180, 270 and 0 degrees.

1562005681807.png


In the hierarchy editor don't forget to set the type of animation (I haven't added the wind animation to my modeldef, but that should be easy to do).

Now export to MDL and you should be fine. The entire object will rotate around its axis. If you tag it with the wind animation it will move with the wind.
 

tgibson

Resource contributor
I don't get this using my converted FS2004 aircraft, because all of my non-animated parts already have a transformation matrix, but no Animation section. When I select one of these non-animated parts and right click the Transformation section I get Edit Transformation... and Delete Transformation...

The transformation matrix is:

1,0,0,0
0,1,0,0
0,0,1,0
0,0,0,1

I can choose Delete Transformation... and this will give me what you have above. Then when I right click I get Add Animation...

Is this OK to remove the Transformation first?
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
If you click on the label with #transformations you should always get the add animation option. I think you clicked on one of the transformations itself, then you get the options to edit that one.
 

tgibson

Resource contributor
Here is a pic of what I'm seeing.

mcx_animation_add.jpg


How do you code a 360 degree rotation in the Animation Key Editor?

I entered 5 "Times", 0, 25, 50, 75, and 100 (I assume that Time is the Keyframe Number).

I chose Quaternion since I couldn't see how to get rotation from the Vector choice.

In RotX I entered 0, 90, 180, 270, and 360. The numbers did not stay as I entered them, I ended up with 0, 90, -180, 90, and 0. I tried several times and they always changed to those numbers.

This resulted in the part rotating 180 degrees and then reversing course and rotating back to the start point. Not a complete rotation.

Help?

Thanks,
 

tgibson

Resource contributor
Ah, I didn't realize that my parts have TWO transformation entries. The Add Animation choice is there, by right clicking the other one. It's the Transformation section above the one I right clicked in the above image.

Now I see you mention #Transformation and not just Transformation. I now see the difference.

Sorry,
 
Last edited:

arno

Administrator
Staff member
FSDevConf team
Resource contributor
I also had some issues entering the rotations. I used 0, 90, - 180, - 90, 0 in the end. But I'll check why it's hard to enter them sometimes.
 
In RotX I entered 0, 90, 180, 270, and 360. The numbers did not stay as I entered them, I ended up with 0, 90, -180, 90, and 0. I tried several times and they always changed to those numbers.
This resulted in the part rotating 180 degrees and then reversing course and rotating back to the start point. Not a complete rotation.
And I have the same problem.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Hi Dick.

Is your issue the key frame values like Tom and Roby say? Or saving an animation in general?
 

rhumbaflappy

Moderator
Staff member
Resource contributor
I work around the keyframe issue by using a "-" where needed. My issue is in saving a MDL or .x file. The animation appears to be dropped.

Edited:

I imported a dae file. After I exported as a MDL file, I reimported it and was able to add an animation and assign an animation type ( Action01 ), so my problem is solved, by the extra step od saving MDL and re-importing that MDL.
 
Last edited:
(O:Weather.AmbientWindDirection, Degrees) 360.0 / 100 *
Could it be, Christian, that this is only for simobjects and not for scenery objects?

windsock_testing.jpg


Unless, which is probable, I have done something wrong? (I have no bones for the moment, my dog ran off with them:)).
Can someone figure it out?

PS: no animation, no minus symbol helps, nothing shows up. I made it a bgl but maybe I should use an mdl?

Edit: sent wrong screenshot. Now it is the right one.
Edited again: now for one reason or another, after adding several times the quaternion values, MCX now shows a 360 rotation (But nothing shows up in the Sim yet:(.
 

Attachments

Last edited:

arno

Administrator
Staff member
FSDevConf team
Resource contributor
I didn't test in sim yesterday, but I did save the animation to mdl and loaded the mdl again with the animation still there.
 
Sure, in MCX the animation is still there and shows up. But the model does not in the Sim!
Could you spare a moment and test it in the sim so that I can rule out some mistakes of mine?
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Hopefully tonight, typing this from my phone, P3D doesn't run that well on there :D
 

Christian Bahr

Resource contributor
Could it be, Christian, that this is only for simobjects and not for scenery objects?
For SimObjects, I have never tested the code. The code refers to BGL files or objects that can be stored in a BGL-Lib. The code certainly works with BGL files.

Unless, which is probable, I have done something wrong? (I have no bones for the moment, my dog ran off with them:)).
Can someone figure it out?
Your code is incomplete, it should be structured as follows:

Animation name="muelheim_windsack" guid="45610dae-e726-4d3e-b4db-6d704a6f2332" length="100" type="Sim" typeParam2="muelheim_windsack" typeParam="AutoPlay" />
<PartInfo>
<Name>muelheim_windsack</Name>
<AnimLength>100</AnimLength>
<Animation>
<Parameter>
<Code>
(O:Weather.AmbientWindDirection, Degrees) 360.0 / 100 *
</Code>
<Lag>10</Lag>
</Parameter>
</Animation>
</PartInfo>

The red marked text should be changed! Then all the code is copied to the current modeldef.xml. In the MCX, the code can then be tagged with the animation of the windsock.


I also had some issues entering the rotations. I used 0, 90, - 180, - 90, 0 in the end.
The animation should be as follows:

keys_quaternion_rotation_animation.jpg


Degrees: 0, -90, -180, -270, -360
Keys : 0, 25, 50, 75, 100
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Hi,

I just tested it again here and apart form the issue that entering the angles in MCX is a bit tricky (like Dick said putting a minus key at the right position helps), the object works fine.

I used the animation code Christian posted and my windsock moves fine with the wind. I have attached the BGL, it is located at N40 W40.
 

Attachments

rhumbaflappy

Moderator
Staff member
Resource contributor
Finally, I figured out how to do a wind rotation.

XML:
<?xml version="1.0" encoding="utf-8" ?>
<ModelInfo>
    <Animation name="wind_rotate" guid="11ea2877-6bee-41ef-8216-4a3306815e5c" length="100" type="Sim" typeParam2="wind_rotate" typeParam="AutoPlay" />

  <PartInfo>
    <Name>wind_rotate</Name>
    <AnimLength>100</AnimLength>
    <Animation>
      <Parameter>
        <Code>
          (O:Weather.AmbientWindDirection, Degrees) 360.0 / 100 *
        </Code>
        <Lag>10</Lag>
      </Parameter>
    </Animation>
  </PartInfo>

</ModelInfo>
The guid can be any valid generated guid. It just identifies the animation in the sim. I chose wind_rotate for the name. Hundreds of objects could share this animation.

Make sure ModelConverterX uses the right model definition file containing the animation code. I used the above, and named it "object_conditions.xml". Add it to MCX, exit MCX, re-open MCX and it points to the right definitions file.

In MCX' hierarchy editor, click the model part you wish to edit. Right-click on # Transformation, and select Add animation.
With the animation for the part added, Right-click on Animation, and select Edit animation...

In the popup Animation key editor, click on Add. To the right, select Type Quaternion.
To the left, click Add again. To the right, set time as 25, set Rot Z as 90, go above to W and place "-" before the 0.70711 (-0.70711) and press Normalize button.

Click Add again, time set as 50, Rot Z set as 180, press normalize button.

Click Add again, time set as 75, Rot Z set as 90, press Normalize button

Click Add again, time set as 100, Rot Z as 0, press Normalize button. Click OK and popup disappears.

In the hierarchy editor, right-click on the animation name (unknown), and select wind_rotate. Close hierarchy window.

Hierarchy_editor.png


You can now save as P3Dv4.4 MDl or .x or library bgl or placed bgl.
The object rotates with the wind to point the direction the wind is moving to (not from).

An example placed bgl is included in the zip file.
 

Attachments

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Hi,

No need to press normalize after entering the angles. That's only needed when you edited the quaternion values directly and the quaternion length is not one anymore. So adding a minus doesn't change the length.
 
Animating my windsock day 3!:eek:

Sorry to bother you folks again:(.
I have a new problem:rolleyes:!
I cannot get the modeldef.xml entry to stick to the model.
Each time I save and compile, the modeldef.xml shows only the first line if 'show used only':

<?xml version="1.0" encoding="utf-8"?>
<ModelInfo>
<Animation name="vindstrut" guid="9477a4d9-9347-479a-9eb1-e63e6d0ff2ad" length="100" type="Sim" typeParam2="vindstrut" typeParam="AutoPlay" />
But only on unchecking this 'show used only' I get to see the rest:
<PartInfo>
<Name>"vindstrut"</Name>
<AnimLength>100</AnimLength>
<Animation>
<Parameter>
<Code>
(O:Weather.AmbientWindDirection, Degrees) 360.0 / 100 *
</Code>
<Lag>10</Lag>
</Parameter>
</Animation>
</PartInfo>
</ModelInfo>

What do you have to do in MCX to make it stick?

hierarchy editor.jpg


I thought it was because I had saved my so called "modeldef_wind.xml" in the program files folder, but I also tried to put it in "documents" and other places but all to no avail (and yes, I pointed to the right path in the MCX options).
My windsock shows up alright but still does not move with the wind and obviously because the Modeldef Editor does not want to save my complete entries.
Apparently and in spite of all the information we have been given by the three of you, I am once more the dumdumb for being the only one that does not get it done (sigh).
It is happy hour so I am allowing myself a drink now.

Cheers
 
Top