Slew

Discuss on the SimConnect SDK can be used by programmers to write add-on components for Prepar3D
Locked
petesk8
Posts: 12
Joined: Thu Jan 05, 2012 10:10 am

Post by petesk8 »

Hi All,

I am having trouble with toggling SLEW mode.

I use

SimConnect_MapClientEventToSimEvent(hSimConnect, EVENT_SLEW_SET, "SLEW_TOGGLE");

to set up the event and

SimConnect_TransmitClientEvent(hSimConnect, 0, EVENT_SLEW_SET,0,SIMCONNECT_GROUP_PRIORITY_DEFAULT, SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY);

to activate it but it doesn't work.

I can perform similar steps to toggle pause mode and that works fine.

Can anyone shed any light on what I am missing here .

Thanks.

User avatar
jimcooper1
Posts: 715
Joined: Fri Jan 21, 2011 3:37 pm

Post by jimcooper1 »

Your syntax looks absolutely fine, SLEW_TOGGLE should work

Have you tried setting the DWORD to 1 (instead of 0) ? '0' should work but maybe it needs a '1' to get the toggle to activate???

SimConnect_TransmitClientEvent(hSimConnect, 0, EVENT_SLEW_SET,1,SIMCONNECT_GROUP_PRIORITY_DEFAULT, SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY);



Alternatively is it possible to use 2 events instead: ie SLEW_ON and SLEW_OFF, not as elegant but if there is a bug with SLEW_TOGGLE it's a temporary work-around.



Regards



Jim

petesk8
Posts: 12
Joined: Thu Jan 05, 2012 10:10 am

Post by petesk8 »

Hi Jim,

Thanks for the reply. I have tried using 1 instead of 0 and I have also tried SLEW_ON / OFF to no effect

however adding

hr = SimConnect_MapInputEventToClientEvent(hSimConnect, INPUT_ZX, "ctrl+shift+A", EVENT_SLEW_TOGGLE);



(and changing previous id EVENT_SLEW_SET to EVENT_SLEW_TOGGLE)

works when I press 'ctrl+shift+A' at the P3d focused keyboard. That's all very well but I want to toggle externally by command from the Simconnect client ie via SimConnect_TransmitClientEvent).

Trying to Freeze the aircraft using the appropriate EVENT ids and SimConnect_TransmitClientEvent also proved negative. Have I got the wrong end of the stick in usage or should It be just as simple as using SimConnect_MapClientEventToSimEvent and SimConnect_TransmitClientEvent ?

Regards, Pete
User avatar
jimcooper1
Posts: 715
Joined: Fri Jan 21, 2011 3:37 pm

Post by jimcooper1 »

Pete



I'm just a beginner with SimConnect myself, I tend to create all my custom controls and events as embedded DLLs. So are you using SLEW as a method of freezing the aircraft (without pausing) or are you then subsequently slewing the aircraft? You state above that you want to Freeze the aircraft so have you tried FREEZE_LATITUDE_LONGITUDE_TOGGLE, FREEZE_ATTITUDE_TOGGLE and FREEZE_ALTITUDE_TOGGLE instead??



Jim
petesk8
Posts: 12
Joined: Thu Jan 05, 2012 10:10 am

Post by petesk8 »

Jim,

I have tried the FREEZE events as above without success leading me to think I must be missing a step.

Originally the idea was to have FSX render our simulator(s) visual world only and not digging too deep into the SDK I came up with moving a default aircraft around. Slew was required to stop simulation position updates interfering with the client updates (jitters) and worked very well (pausing and updating wasn't an option as terrain height feedback wasn't updated). Now of course, with P3D, I can delve deeper into external sim mode but I would still like to find the solution to the current issue as I'll possibly need control over a number of other events.

Pete.
petesk8
Posts: 12
Joined: Thu Jan 05, 2012 10:10 am

Post by petesk8 »

Doh,



ObjectID should be set to 1 for SimConnect_TransmitClientEvent to work on user aircraft.



If set to 0 it works on general sim events for example "PAUSE_TOGGLE" , pauses/unpauses whole simulation I assume.



I could've sworn I did the above originally. I'm Swearing now.



Incidently, it has been indicated that the user aircraft ID isn't always 1 and can change for example in multilayer mode



http://www.fsdeveloper.com/forum/showthread.php?t=8833























Locked