aua668 Posted November 15, 2015 Report Posted November 15, 2015 Pete, I am using FSUIPC 4.948 with P3D 2.5 under WIN 7/64. I tried to use the offsets 86A0..86B4 to set the current camera position relative to the defined eyepoint. The values should be float as described and should be written as a structure. I tried to test this with the following code: -- test eyepoint setting -- play with these values local lX = 0.0 local lY = 0.0 local lZ = 0.0 local lPitch = 0.0 local lBank = 0.0 local lHeading = 0.0 -- now set the eyepoint ipc.writeStruct( 0x86A0 , "6FLT" , lX , lY , lZ , lPitch , lBank , lHeading ) -- X, Y, Z, P, B, H What I found: Float is not working. I have to use Integer (32-bit). By that I can write positive values only and only in degrees. So writing 0x000F to the heading Offset for example really moves the camera 15 degrees in the right direction. It seems if the binding to the Simconnect function is not correct. If I try to use float values other than zero, the result is completely wrong. Please check the code for implementation gain. Reading the thread, where you implemented this feature, it obviously did work in 4.939t. But If I use your test sample code there, it gives a completely wrong setting for me. It might of course be a bug on LM side too. RgdsReinhard
Pete Dowson Posted December 7, 2015 Report Posted December 7, 2015 What I found: Float is not working. I have to use Integer (32-bit). By that I can write positive values only and only in degrees. So writing 0x000F to the heading Offset for example really moves the camera 15 degrees in the right direction. It seems if the binding to the Simconnect function is not correct. If I try to use float values other than zero, the result is completely wrong. Please check the code for implementation gain. Reading the thread, where you implemented this feature, it obviously did work in 4.939t. There's been no change in it I can recall. The code was written once and left as it was. Anyway, I've changed the way I access the bytes as Float (via float * casting instead of direct value casting), so see if this is any better. FSUIPC4948c_TEST.zip Let me know, please. Pete
aua668 Posted December 8, 2015 Author Report Posted December 8, 2015 Pete, It works perfectly now with that version. Many thanks !!! Reinhard PS: As there is Christmas coming soon: It would be great if SimConnect_CameraSetRelative6DofByName also could be supported: SimConnect_CameraSetRelative6DofByNameThe SimConnect_CameraSetRelative6DofByName function is used to adjust the specified view's camera.Syntax HRESULT SimConnect_CameraSetRelative6DofByName( HANDLE hSimConnect, const char* szName, float fDeltaX, float fDeltaY, float fDeltaZ, float fPitchDeg, float fBankDeg, float fHeadingDeg); This would allow to manipulate any camera view and not only the main view ...
Pete Dowson Posted December 8, 2015 Report Posted December 8, 2015 PS: As there is Christmas coming soon: It would be great if SimConnect_CameraSetRelative6DofByName also could be supported: This would allow to manipulate any camera view and not only the main view ... Unknown length names are not easily supported by the offset method. I would have to limit the length to a specific size. What would be reasonable but not too extravagant? And since all the other parameters are the same I would need to reuse those offsets -- so the nameless ones would first need zero in the first offset byte for the name. Pete
aua668 Posted December 9, 2015 Author Report Posted December 9, 2015 Pete, I checked the standard camera names of P3D. The simulator adds to hese names typically " - View xx": Cockpit - View 00 Virtual Cockpit - View 00 Spot - View 00 Locked Spot - View 00 FlyBy - View 00 Top-Down - View 00 Nearest Tower - View 00 Facilities Tower - View 00 Facilities Runway - View 00 AI Planes - View 00 Multiplayer Planes - View 00 IR (White Hot) - View 00 IR (Black Hot) - View 00 NVG (White Hot) - View 00 NVG (Black Hot) - View 00 Weapons - View 00 Static - View 00 RadarCamera - View 00 The longest name I found was 28 characters long. So this can be used as a guideline for the length. With 30 chars I believe you are on the safe side. For the own cameras you can influence the length of the camera name. The only uncertain names are the aircraft cameras, which are defined in the aircraft.cfg files. Anyhow you can shorten names there too. So if someone is so experienced to control cameras from LUA, he/she should also be able to edit names of cameras ;-) The reuse of the existing offsets was exactly what I thought. No problem with that. Best regards Reinhard
Pete Dowson Posted December 10, 2015 Report Posted December 10, 2015 The longest name I found was 28 characters long. So this can be used as a guideline for the length. With 30 chars I believe you are on the safe side. For the own cameras you can influence the length of the camera name. The only uncertain names are the aircraft cameras, which are defined in the aircraft.cfg files. Anyhow you can shorten names there too. So if someone is so experienced to control cameras from LUA, he/she should also be able to edit names of cameras ;-) I'd round to a nice 32 bytes. I've implemented it but it won't work at present because the "...ByName" function isn't in any of the FSX SimConnect libraries so I have to recompile my wrapper, SimConnectP3D2.DLL with that function supported. However, I can't get it to compile with either the P3D v2 SimConnect.lib or the version 3 one -- different errors, unfulfilled imports. I've no idea at present how to satisfy those (the P3Dv2 one needs an "Exception" Class and I've no idea where that comes from). So I've put a request for help on the developer section of the L-M Forum. Pete
Pete Dowson Posted December 10, 2015 Report Posted December 10, 2015 I've implemented it but it won't work at present Ok. I think I've fixed that. I'll test a bit in the morning then let you have a copy to test more thoroughly. Pete
aua668 Posted December 11, 2015 Author Report Posted December 11, 2015 Hi Pete, I detected, that you have uploaded version 4.948e. I downloaded this version, installed it and it works great !!! Christmas is here :razz: :razz: :razz: To give you an impression, how I use this function: I have a setup with three screens for the outside world and two touch screens below for the panels. With that I fly several planes (Fokker 100, Airbus, Dash 8 Q400, Twin Otter). Especially with the newer planes with virtual cockpits only you have to create several camera views so that you can switch through the several views easily. But you have only 10 hotkeys for cameras. So you can navigate to a special view not directly but only by stepping through views. With that function I use only one cockpit camera, I define the several views in a LUA table and I can reach each camera per index. So no limit of hotkeys anymore. It's really great, how your program improves missing or limited functionality. Many thanks To Santa Pete ... Reinhard
Pete Dowson Posted December 11, 2015 Report Posted December 11, 2015 Very clever! Maybe you could write it up and post it to the User Contributions subforum.? Others may want to do something similar. Pete
spokes2112 Posted December 12, 2015 Report Posted December 12, 2015 Reinhard, Very interested! Hope you're willing to share. LUA rocks! Roman
aua668 Posted December 13, 2015 Author Report Posted December 13, 2015 Hi, As this is part of a large number of LUA modules, I will extract these things to show, how it could be used. I will need some time, but of course I will share this. Rgds Reinhard
aua668 Posted June 13, 2016 Author Report Posted June 13, 2016 Pete, I switched to P3D 3.3.5 (by using FSUIPC 4.955) in the meanwhile. As P3D v3 is much smoother in terms of rendering, I changed my 3 screens for the outside view, where I had one large Eyefinity screen (combined via nVidia) to three seperate views (less distortion). So my views for the outside world are now named "3D view - View 01", "3D view - View 02", "3D view - View 03". Before I only had one view ("3D view 01"). I wanted to manipulate now this several views with this function. According to the P3D SDK, the function SimConnect_CameraSetRelative6DofByName should manipulate either cameras (and thereby all views) or single views: Quote hSimConnect [in] Handle to a SimConnect object. szName [in] The name of the camera. This can either match the window title or the name of the camera definition. If the window title is used only the camera for that window will be modified. If the camera definition name is used and more than one window is open corresponding to that definition than all of those windows will be modified. But it's only working for cameras (and there only for the first view). If I call the function with the name parameter "3D view", it works for the first screen and I can manipulate heading etc. If I use "3D view - View 01" etc. it doesn't give any reaction. I assigned different cameras to each of the three views and then I am able to manipulate each of them. So I have a workaround. My question is: I assume, you must be looking for the hSimConnect handle by some methods. Are looking for cameras as well as for views to get this handle, or maybe only for cameras? No idea, how this is done in SimConnect, but I assume, you know. As I said - I have a workaround. But maybe, when you have time, you may look again into that code. Best regards Reinhard
Pete Dowson Posted June 13, 2016 Report Posted June 13, 2016 6 minutes ago, aua668 said: My question is: I assume, you must be looking for the hSimConnect handle by some methods. Are looking for cameras as well as for views to get this handle, or maybe only for cameras? No idea, how this is done in SimConnect, but I assume, you know. The SimConnect handle is the one FSUIPC gets when it first opens a dialogue with SimConnect, during initialisation. It is used for everything, 100% of all requests from and commands to SimConnect! It finally uses it to close the connection at the end, when FS is closing. The only time it gets a new one is if it thinks the current connection has failed (my SimConnect timeout has expired), or you use the re-connect SimConnect control option. 8 minutes ago, aua668 said: As I said - I have a workaround. But maybe, when you have time, you may look again into that code It just passes on the parameters you supply. Nothing more, nothing less. I think you'll need to report it as a P3D fault if you think it doesn't work. Pete
aua668 Posted June 13, 2016 Author Report Posted June 13, 2016 Hi, I have reported there too. I just wanted to cross-check here, if there might be something missing Piece in the implementation. Thanks for the quick clarification, Best regards Reinhard
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