- Messages
- 578
- Country
Hello guys
back in P3D days I've worked on an Addons that used nose wheel position in order to calculate some distances, my method to get this position was to request attachpoint world position of a taxi light effect used by the aircraft developer
this method used to work very well.
Now, I'm developing for MSFS and I don't see no request attach point data in the simconnect docs nor the H file.
so I tried to calculate this position my self using the position of the aircraft, the distance to the nose wheel, and the aircraft heading
I ended up with this code :
unfortunately, this code works perfectly only in the center of the earth map, or the surrounding areas, once I'm at EGLL or some northern airports, the wheel position calculation seems off, the offset varies from 2 to 8 meters depending on the heading of the aircraft
I tried this solution I found on the net but still no luck (the calculation is very offff)
I tried to use contact points in the flightmodel.cfg but it only gives the distance to the wheel
Any Idea ??
thanks in advance
back in P3D days I've worked on an Addons that used nose wheel position in order to calculate some distances, my method to get this position was to request attachpoint world position of a taxi light effect used by the aircraft developer
this method used to work very well.
Now, I'm developing for MSFS and I don't see no request attach point data in the simconnect docs nor the H file.
so I tried to calculate this position my self using the position of the aircraft, the distance to the nose wheel, and the aircraft heading
I ended up with this code :
C++:
WorldPos User;
WorldPos Nosecoord;
double distance;
_angle = deg2rad(_angle);
Nosecoord.Latitude = User.Latitude + (MeterToCoordinates(_distance * cos(_angle)));
Nosecoord.Longitude = User.Longitude + (MeterToCoordinates(_distance * sin(_angle)));
unfortunately, this code works perfectly only in the center of the earth map, or the surrounding areas, once I'm at EGLL or some northern airports, the wheel position calculation seems off, the offset varies from 2 to 8 meters depending on the heading of the aircraft
I tried this solution I found on the net but still no luck (the calculation is very offff)
Code:
// _coord is user position and coord is nose position
double R = 6378.1; //Radius of the Earth
double brng = deg2rad(_angle);
double d = _distance * 1000; // in Km
_coord.Latitude = deg2rad(_coord.Latitude);//
_coord.Longitude = deg2rad(_coord.Longitude);
coord.Latitude = asin(sin(_coord.Latitude) * cos(d / R) +
cos(_coord.Latitude) * sin(d / R) * cos(brng));
coord.Longitude = _coord.Latitude + atan2(sin(brng) * sin(d / R) * cos(_coord.Latitude),
cos(d / R) - sin(coord.Latitude) * sin(coord.Latitude));
I tried to use contact points in the flightmodel.cfg but it only gives the distance to the wheel
Any Idea ??
thanks in advance