• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Is there any way to reset a camera view?

Messages
120
Country
unitedstates
So the little app I am writing moves the camera around the VC. I would like to add a reset button so I can reset the initial or default camera XYZ PBH values but I don't see an API for this in the SimConnect SDK.

Did I miss it or can we not do a camera reset?

Thanks...
 
Ralph,

Look at the eventIDs there is a EYEPOINT_RESET. See if sending that helps.
 
Yes I see that EYEPOINT_RESET constant in the Event IDs document...but how do I make such a call in c#? I googled for examples of how to do this but didn't find one. I'm sure the call is a one liner.
 
Well, I had a look at the TransmitClientEvent() function and I looked at the SDK but I still don't understand all of the arguments for resetting the camera eye point.

The line I've come up with so far (shown at the bottom) gives me an error in the EYEPOINT_RESET argument: does not exist in the current context.

I'm using C# so the SDK examples don't map one to one. I guess by choosing to use C# vs C++ as the examples are written in, I've really got an up hill battle in getting my app to work!

The SDK says:
TransmitClientEvent()
Parameters
hSimConnect
[in] Handle to a SimConnect object.
ObjectID
[in] Specifies the ID of the server defined object. If this parameter is set to SIMCONNECT_OBJECT_ID_USER, then the transmitted event will be sent to the other clients in priority order. If this parameters contains another object ID, then the event will be sent direct to that sim-object, and no other clients will receive it.
EventID
[in] Specifies the ID of the client event.
dwData
[in] Double word containing any additional number required by the event. This is often zero. If the event is a ESP event, then refer to the Event IDs document for information on this additional value. If the event is a custom event, then any value put in this parameter will be available to the clients that receive the event.
GroupID
[in] The default behavior is that this specifies the GroupID of the event. The SimConnect server will use the priority of this group to send the message to all clients with a lower priority. To receive the event notification other SimConnect clients must have subscribed to receive the event. See the explanation of SimConnect Priorities. The exception to the default behavior is set by the SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY flag, described below.
Flags
[in] One or more of the following flags:
SIMCONNECT_EVENT_FLAG.GROUPID_IS_PRIORITY

Here is my line but I'm not sure if the first, second or third arguments are correct. I'm pretty sure the last 3 arguments are correct:

simconnect.TransmitClientEvent(SimConnect.SIMCONNECT_OBJECT_ID_USER, 0, SimConnect.EYEPOINT_RESET, 0, SimConnect.SIMCONNECT_GROUP_PRIORITY_HIGHEST, SIMCONNECT_EVENT_FLAG.GROUPID_IS_PRIORITY);
 
Ralph,

First add a new EVENTS enum

Code:
        enum EVENTS : uint
        {
            CAMERA_DOLLY_LEFT,
            CAMERA_DOLLY_RIGHT,
            CAMERA_DOLLY_UP,
            CAMERA_DOLLY_DOWN,
            CAMERA_DOLLY_FORWARD,
            CAMERA_DOLLY_BACK,
            CAMERA_LENS_PITCH_UP,
            CAMERA_LENS_PITCH_DOWN,
            CAMERA_LENS_BANK_LEFT,
            CAMERA_LENS_BANK_RIGHT,
            CAMERA_LENS_RIGHT,
            CAMERA_LENS_LEFT,
            CAMERA_RESET,
        };

Add all the mapto etc. like the other mappings. The one you don't need this time is MapInputEventToClientEvent

Code:
                simconnect.MapClientEventToSimEvent(EVENTS.CAMERA_RESET, "EYEPOINT_RESET");

......


                simconnect.AddClientEventToNotificationGroup(NOTIFICATION_GROUPS.GROUP0, EVENTS.CAMERA_RESET, false);

Then add a button for the reset that will transmit the reset event. Also reset all values to 0.

Code:
        private void buttonCameraReset_Click(object sender, EventArgs e)
        {
            cameraDollyLeftRight = 0.005f;
            cameraDollyLeftRightAdjustment = 0.005f;
            cameraDollyUpDown = 0.005f;
            cameraDollyUpDownAdjustment = 0.005f;
            cameraDollyForwardBack = 0.01f;
            cameraDollyForwardBackAdjustment = 0.01f;
            cameraLensPitchUpDown = 0.0f;
            cameraLensBankLeftRight = 0.0f;
            cameraLensLeftRight = 0.0f;

            counter = 0;
            movingCameraDolly = false;
            simconnect.TransmitClientEvent((uint) SimConnect.SIMCONNECT_OBJECT_ID_USER, EVENTS.CAMERA_RESET, (uint) 0, INPUT_GROUPS.INPUT0, SIMCONNECT_EVENT_FLAG.GROUPID_IS_PRIORITY);
        }
 
Thank you Ron, that worked great...!!!

So we are zeroing out the XYZ and the PBH DOF() values and when I do this reset, my camera view looks like I'm sitting in the Captains seat looking forward. I'm using the CS777 aircraft.

So what is positioning to this point in the cockpit? Is it the eyepoint values in the aircraft.cfg file? The so called reference datum?
 
So what is positioning to this point in the cockpit? Is it the eyepoint values in the aircraft.cfg file? The so called reference datum?

Not the refernce datum, but the eye point related to the reference datum point. That is why you don't change the

[Views]
Eyepoint =x,y,z

values.

You want to change the camera views Initialxyz. Unless you really do want to be a taller pilot sitting in the seat. Since I think your camera move program is there to create new camera views and not just move the default eyepoint. Read the camera config stuff in the SDK.
 
Yes, I played around changing the aircraft.cfg [Views] eyepoint values. They must be offsets from the aircraft reference datum point because it positions the camera squarely in the captains seat. Thanks for clarifying this.

And yes, I want to be able to create a new camera view and assign a hot key to call up that view. When I was using EZDok and OpusFSI, I created views and assigned keys to them; for the 737NGX MCP panel (the auto pilot panel) I used the 'a' key to display that panel. I created a Captain's view and assigned 'c' to display that view, etc.
 
Back
Top