Hello.
I am trying to write a planet module but coming up against a basic problem. I have probably misunderstood something, but I can't work out what it is.
My module needs to know information about the Moon in order to do its own ephemeris calculation. The problem is, I can't get a handle to the Moon - the oapiGetGbodyByName("Moon") function keeps returning NULL. My planet renders, but at the centre of the Earth - it's defined as Earth:Moon2 = MyPlanet in the Sol configuration file. Here's part of my code:
Does anyone know what I am doing wrong? Thanks for any help.
I am trying to write a planet module but coming up against a basic problem. I have probably misunderstood something, but I can't work out what it is.
My module needs to know information about the Moon in order to do its own ephemeris calculation. The problem is, I can't get a handle to the Moon - the oapiGetGbodyByName("Moon") function keeps returning NULL. My planet renders, but at the centre of the Earth - it's defined as Earth:Moon2 = MyPlanet in the Sol configuration file. Here's part of my code:
Code:
int MyPlanet::clbkFastEphemeris(double SimT, int Req, double *pStateVector)
{
// Get a handle to the Moon.
OBJHANDLE hMoon(oapiGetGbodyByName("Moon"));
if(!hMoon) return 0;
// Get a CELBODY interface to the Moon.
CELBODY *pMoon(oapiGetCelbodyInterface(hMoon));
if(!pMoon) return 0;
// State vector store.
Vector3<double> Data[4];
// Get the state vector of the Moon at this SimT.
pMoon->clbkFastEphemeris(SimT, EPHEM_TRUEPOS | EPHEM_TRUEVEL, (double *)Data);
Does anyone know what I am doing wrong? Thanks for any help.