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:
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:
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!
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!


