Targeting Pod Camera Pitch adjustment

charlie00123
Posts: 7
Joined: Sun Jun 16, 2019 1:25 pm

Targeting Pod Camera Pitch adjustment

Postby charlie00123 » Wed Jun 19, 2019 3:41 pm

Hello all!
I posted a question a few days ago, about the changing of targeting Pod pitch range.
Though your answers were very helpful, which I really appreciate, yet they didn't solve the actual problem I'm facing.
I'm posting the screenshots of two different targeting Pods so I may explain my problem properly.

Here's the default targeting pod view that comes out of the box with the P3D.
https://drive.google.com/open?id=1MitN- ... UNKb1ikqWU

You can see the pitch has a range of +-90°

Now, here's the interface I want.

https://drive.google.com/open?id=1cjbrE ... oOIlUw3_dR

You can see the pitch range is -120° to 30°

How do I set the pitch between -120° and 30°?
The arrow indicating the pitch value won't stop on 30, and i won't go below -90. I've tried to limit it in the DLL, as well as in ActionScript. But no luck.

Does anyone have as solution for this?
Thanks in advance.

adiemus
Posts: 117
Joined: Fri Mar 16, 2012 4:19 am
Contact:

Re: Targeting Pod Camera Pitch adjustment

Postby adiemus » Wed Jun 19, 2019 4:38 pm

You're going to need to provide far more detail on what you've actually tried, likely with example code and explicit test results explaining how those results differ from what you'd expect.[1] Otherwise it just seems like you're trying to get someone else to not just build it for you, but also explain the process and underlying concepts to you, which is doubly unlikely to entice many takers.

(JB already gave you the high-level answer. You'll need to implement the math yourself to translate the limits imposed by the P3D implementation into the limits you want. It's effectively just an [admittedly hairy] translation between rotation matrices)

[1] NOTE: "[W]hat you'd expect" is very different from "What you'd like." We'd all like the sim to work in a way that makes it easy to implement our various pet projects/priorities. But it doesn't, nor can it. It's up to you to work to understand the abilities and limitations of the sim, and then to build a solution on top of that foundation to implement what you're wanting to build. You need to develop a realistic expectation of how the sim actually works and go from there.

charlie00123
Posts: 7
Joined: Sun Jun 16, 2019 1:25 pm

Re: Targeting Pod Camera Pitch adjustment

Postby charlie00123 » Thu Jun 20, 2019 6:00 pm

Sure I'm uploading my code snippet below along with other details I searched or techniques I tried to apply.

Code: Select all

// Rotate camera (y axis) case KEY_HOTAS_SLEW_AXIS_Y: { g_spControllableCamera->DeactivatePositionTracking(); g_spControllableCamera->DeactivateEntityTracking(); CComPtr<IBaseObjectV400> pBaseObject = nullptr; CComPtr<IFireControlSystem> pFireControlSystem = nullptr; if (PdkServices::GetSimObjectManager() != nullptr) { PdkServices::GetSimObjectManager()->GetUserObject(&pBaseObject); if (SUCCEEDED(pBaseObject->QueryService(SID_FireControlSystem, IID_IFireControlSystem, (void**)&pFireControlSystem))) pFireControlSystem->SetSelectedTargetID(0); } float axisPercent = GetAxisPercent(1, evdata); float zoomScale = GetZoomScale(); g_spControllableCamera->SetContinuousPitch(MAX_MOVE_PAN_DEGREES * axisPercent * zoomScale); break; }
This is the code that comes in the DLL and it increases/decreases the pitch with a factor MAX_MOVE_PAN_DEGREES * axisPercent * zoomScale where MAX_PAN_DEGREES = 10.0, axisPercent would be -1 or 1 depending on the situation that we're increasing the pitch or decreasing it. And zoomScale would be a float value depending on zoomValue.


Now on the ActionScript Side we have the code to move the arrow upside or downwards on the pitch carets as well as the heading carets (in case of change in heading).

Code: Select all

function UpdatePitchHeadingCarets() { var pitch:Number = Prepar3D.VarGet("C:P3DCONTROLLABLECAMERA:GetPitch", "number"); var percentY:Number = (pitch / 90.0); m_verticalTicks.caret.y = percentY * HALF_VERTICAL_TICK_HEIGHT; // Half of design height var pitchInt:int = Math.round(pitch); if (pitchInt > 0) { m_offsetTextY.text = "-" + pitchInt; } else if (pitchInt < 0) { m_offsetTextY.text = "+" + Math.abs(pitchInt); } else { m_offsetTextY.text = " " + pitchInt; } var acHeading:Number = Prepar3D.VarGet("A:PLANE HEADING DEGREES TRUE", "degrees"); var heading:Number = Prepar3D.VarGet("C:P3DCONTROLLABLECAMERA:GetHeading", "number"); var headingDiff:Number = heading - acHeading; var percentX:Number = (NormalizeHeading(headingDiff) / 180.0) m_horizontalTicks.caret.x = percentX * HALF_HORIZONTAL_TICK_WIDTH; // Half of design width var headingDiffInt:int = Math.round(NormalizeHeading(headingDiff)); if (headingDiffInt > 0) { m_offsetTextX.text = "+" + headingDiffInt; } else { m_offsetTextX.text = "" + headingDiffInt; } }
What it does is,it receives the current pitch value from P3D and adjusts the position of arrow on the radial (Same for Heading). Now the problem is, P3D would not send pitch value less than -90.
And it won't stop sending pitch value when it reaches 30°.


Return to “Software Development Kit (SDK) Questions”

Who is online

Users browsing this forum: No registered users and 2 guests