How can I spawn in an Object in relation to my Aircraft

Hi there, I’m a scenery developer and I’m very new to development in this field. I’m trying to spawn in a stationary object a few meters away from my aircraft, which is toggled by some externel app, or in-sim.

I’d really appreciate if someone could help me get started.

Calculate the relative position based on your aircraft‘s current position, the desired bearing and distance.

The required trigometric math is relatively straight-forward to implement: the haversine formula calculates the distance between two given points on a (perfect) sphere, the inverse formula calculates a relative point, given a source point, distance and bearing:

https://www.vcalc.com/wiki/vCalc/Haversine+-+Distance

I had implemented those formulae myself, but replaced them by using:

https://geographiclib.sourceforge.io/C++/doc/index.html

In fact, I am placing „formation aircraft“ relative to the user aircraft, so for some C++ usage example code you may also have a look at:

Specifically:

1 Like

Thank you sir, much appreciated!