odwdinc / Python-SimConnect

Python interface for MSFS2020 SimConnect.dll
GNU Affero General Public License v3.0
277 stars 105 forks source link

Move camera? #86

Open viperML opened 3 years ago

viperML commented 3 years ago

Hello, I am a student from the Polytechnic University of Madrid working in a aerospace project for UAV's. What I am currently doing is getting simulation data from JSBSim, and wanted to display it using MSFS.

By using this interface I am able to send the aircraft position to the sim, but I also wanted to control the camera. I have searched all the documentation and property list but cannot find anything to modify any camera parameters (angles, positions and FOV). Maybe this is possible with SimConnect for P3D, but I haven't tried yet.

I have also tried sending input commands with vJoy to the sim, but turns out to be very unpredictable.

Thanks for your time.

FS2020-USER-TESTER commented 3 years ago

Yes, I investigate this as well and my conclusion was the Sim developers do not provide external camera control interface. The simconnect interface does not seem to be a priority for them. You can send keystrokes but very limited.

There are some interesting discussions in the community about using a pair of components, a custom WASM module, and a external program that feeds custom data. https://forums.flightsimulator.com/t/communication-between-wasm-plugin-and-external-application/358409/7 Currently this is to feed control panel information and I see no sign that anyone has tried to control the cameras. But that is the only direction I have seen that offers a solution (unless Asobo team changes their plans regarding simconnect).

NerdyMuppet commented 2 years ago

I managed to use CameraSetRelative6DOF() by going in the Attributes.py and setting

self.CameraSetRelative6DOF.argtypes = [
            HANDLE,
            c_float,
            c_float,
            c_float,
            c_float,
            c_float,
            c_float
        ]

then I simply did this:

sm = SimConnect()
hr = sm.dll.CameraSetRelative6DOF(sm.hSimConnect,0.0, 10.0, -100.0, 0.0, 0.0, 0.0)

This works for me.

bigsby-exe commented 2 years ago

@NerdyMuppet This is working for me. Thank you for the tip