Raymond van Laake Posted November 20, 2003 Report Posted November 20, 2003 Hi VB programmer, I can't seem to set my aircraft to a certain lat/lon.... Example: when I read the aircraft's position, I get: LAT=41.5096398176553, LON=9.10810299276619 Then I reposition the aircraft. Then when I try to set it back with my VB program to the coordinates above, I land on the northpole.... no fun there! Does anyone have a routine to share to help me out? I use this: Public Function Lat_SET(AcLat As Double) As Boolean Lat_SET = CURRENCY_SET(&H560, AcLat / 90# * (10001750# * 65536# * 65536#) / 10000#) End Function Public Function Lon_SET(AcLon As Double) As Boolean Lon_SET = CURRENCY_SET(&H568, AcLon / 360# * (65536# * 65536# * 65536# * 65536#) / 10000#) End Function Public Function CURRENCY_SET(address As Long, varDouble As Double) As Boolean If FSUIPC_Write(address, 8, VarPtr(varDouble), dwResult) Then CURRENCY_SET = FSUIPC_Process(dwResult) Else CURRENCY_SET = False RWError = ResultText(dwResult) End Function Thanks! Ray
Pete Dowson Posted November 20, 2003 Report Posted November 20, 2003 If FSUIPC_Write(address, 8, VarPtr(varDouble), dwResult) Then I don't know VB, but the 64 bit value at those offsets is not a double floating point value, but a 64-bit integer. Regards, Pete
jd Posted November 21, 2003 Report Posted November 21, 2003 i use Public Function set_Plane_Lat(lat As Single) As Single ' Planes latitude Dim x As Long Dim dwResult As Long x = lat * 10001750 / 90 Call FSUIPC_Write(&H564, 4, VarPtr(x), dwResult) Call FSUIPC_Process(dwResult) End Function Public Function set_Plane_lon(lon As Single) As Single ' Plane's longitude Dim x As Long Dim dwResult As Long x = lon * 65536 * 65536 / 360 Call FSUIPC_Write(&H56C, 4, VarPtr(x), dwResult) Call FSUIPC_Process(dwResult) End Function let me know if you figure out how to make the plane sit nicely on the ground, and not bounce up and down jd
Pete Dowson Posted November 21, 2003 Report Posted November 21, 2003 let me know if you figure out how to make the plane sit nicely on the ground, and not bounce up and down Doesn't it sit on the ground if you specify zero altitude? Regards, Pete
jd Posted November 21, 2003 Report Posted November 21, 2003 the last time i tried was back in fs2000 and fs2002. there was something screwy. it seemed to be a factor of how much "altitude" the landing gear gave the plane, maybe a little barometric pressure. just when i had it working on my lear, i'd switch to the 737 and it was a bouncing betty. i gave up. i just told the user to place their plane at the departure airport before starting radar contact :-) jd
Raymond van Laake Posted November 22, 2003 Author Report Posted November 22, 2003 Thanks mate, I'll try it out asap, and let you know about the bouncing Ray
Raymond van Laake Posted November 24, 2003 Author Report Posted November 24, 2003 It works very fine, thanks a lot! About the bumping... that seems to be a problem yes. I remember having the same thing years ago when I used Fs98Class.Dll (which was an interface between VB and Fsuipc) and used the same way of solving the problem you have: let the pilot start a flight, and then initiate the program. Thanks again, Ray
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now