• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

MSFS20 SimObjects do not appear if OnGround = 0 when calling CreateAiSimulatedObject

Messages
7
Country
us-northcarolina
I am trying to place an oil slick on a body of water. Since I need to place it at random locations and possibly move it during the game, I am doing this with a SimConnect application and creating the oil slick object as a SimObject. The following code works just fine for placing an instance of my oil slick object:

C#:
            var pos1 = new SIMCONNECT_DATA_INITPOSITION
            {
                Latitude = 33.0435,
                Longitude = -83.788923,
                Altitude = 134.65061,
                Pitch = 0.003039,
                Bank = -0.001544,
                Heading = -176.897159,
                OnGround = 1,       // IF ANYTHING BUT 1, THE OBJECT DOESN'T SHOW UP!!!
                Airspeed = 0
            };
            wrapper.CreateAiSimulatedObject("MyCompany_Slick1", pos1, epaObj1_targetRequestId);

This version looks bad though because of z-fighting so I need to lift this object slightly above the water. The logical way to do this is to set OnGround=0 and give it an Altitude that is slightly above the terrain altitude at that location. If I place the oil Slick SimObject manually with the Scene Editor by turning off "Snap to ground" and lifting it up slightly (which is where the Altitude I'm using came from), it works beautifully. BUT, if I try to do this in my SimConnect code by setting OnGround to 0, the object does not appear. That is the only change from a visible run to an invisible run. This has nothing to do with the SimObject itself because I have tried it with a variety of SimObjects. All are visible with OnGround=1 but invisible/not rendered with OnGround=0. I have tried looking at the SimConnect logs and the output is the same (no errors) in both scenarios.

FYI, this is an experimental project at this point and I started by adapting the Bears sample SimObject project so the sim.cfg file where my oil slick is defined contains these lines:

Code:
...
[fltsim.4]
title=MyCompany_Slick1
model=Slick1
texture=Slick1
 
[General]
category=Animal
DistanceToNotAnimate=1500
...

I haven't seen any documentation that says Animal type SimObjects cannot be airborne but maybe I missed it. And if that were the issue, it would seem that the Scene Editor in MSFS would not let me uncheck "Snap to ground" when I place the exact same SimObject manually. Nevertheless, I have tried changing the category to FlyingAnimal, but that didn't make any difference either.

Any suggestions would be greatly appreciated!
 
If your object is a flat plane, you could remake it as an object with some depth to eliminate the z-fighting?
 
If your object is a flat plane, you could remake it as an object with some depth to eliminate the z-fighting?
Thanks for the reply @rhumbaflappy ! Yes, it is a flat plane. One workaround we've considered is to just bake in the vertical offset we need by moving the model origin down a little, but we haven't tried that yet. Turning it into a flattened cube is a good backup plan if the offset alone doesn't work.

I'm really hoping we can understand and fix the fundamental problem of not being able to control the altitude of a non-aircraft object. We have other random objects we want to throw into the environment and have them sit at various heights above or embedded in the terrain. Since this can be done with the Scenery Editor, and the Altitude and OnGround parameters are part of the SIMCONNECT_DATA_INITPOSITION struct, it just seems like it should be possible.
 
I'll go ahead and recommend you configure your SimObject to be an AI ship, it is pretty simple coding in that there is no "on ground" setting, essentially, AI ships configure like scenery objects with a little bit of sim.cfg thrown in to give them a set speed, acceleration, "static_cg_height" and a very few other parameters. I have learned that MSFS water is not mathematically "flat," far from it and it swells up near and over land, kind of like extreme surface tension. Here is an example of a SImObject at "sea" level, being consumed by the sea.

swamped.jpg


You can see the RHIB is submerged about 3 or 4 feet, which is also happening to the bigger SimObject, but is less apparent due to its relative size. A solution is to move away from land, or to change the static_cg_height to compensate. This elevation trick allowed an AI ship to be set on a course on an inland waterway, which is 200 feet above sea level. Through trial and error it was able to be placed and activated, something you could try.

Barge two.png
.
 
Back
Top