Unable to find some Variables in documentation

SDK supports Prepar3D’s philosophy of an open development architecture and encourages third parties to bring new innovations with improved add-ons and training content.
Post Reply
tauseefAhmed
Posts: 38
Joined: Wed Jul 31, 2019 4:56 pm

Unable to find some Variables in documentation

Post by tauseefAhmed »

Hello,
I'm trying to figure out an issue related to Variables that P3D uses. In the Scaleform samples provided with the SDK, there are some variables used for different purposes (I'm not getting into details of functionality).
i.e.

Code: Select all

 Prepar3D.VarSet("K:ToggleDesignator", "number", 1);

Code: Select all

Prepar3D.VarSet("K:HOTAS_KEY_A0", "number", 1);

Code: Select all

Prepar3D.VarSet("K:HOTAS_SLEW_AXIS_Y", "number", -10000);

Code: Select all

Prepar3D.VarSet("K:HOTAS_SLEW_AXIS_X", "number", -10000);

Code: Select all

Prepar3D.VarGet("A:GetDesignator", "boolean");

I know what purpose these Variables are being used for, but I can't find them anywhere in the documentation. But I can't figure out how they behave (i.e. What parameters does the ToggleDesignator set and how). And how do I Set these variables outside the Scaleform.
There might be more of them right? It would be better if all of them are included in Variables Section of Learning Center.
Can someone from LM please help me with this? I want to know what other Simulation or Key Variables are there that I can utilize besides these.


Best Regards,
Tauseef
Clifton Crane
Lockheed Martin
Posts: 1207
Joined: Tue Sep 25, 2012 2:34 pm

Re: Unable to find some Variables in documentation

Post by Clifton Crane »

Hi tauseefAhmed,

The "HOTAS" events are generic key events that can be used to process arbitrary input by a plugin. The "HOTAS" events can be set through the Controls UI. These are not currently documented in the Learning Center, however the full list is available in the gauges.h C++ header.

The ToggleDesignator and GetDesignator properties are specific to the AvatarSim and are used by DIS to broadcast Designator PDUs. There is also a PDK service IDesignatorServiceV340 that can be used to implement your own designator implementation.

Hope this helps!

Regards,
Clifton
Clifton Crane
Prepar3D® Software Engineer Sr.
tauseefAhmed
Posts: 38
Joined: Wed Jul 31, 2019 4:56 pm

Re: Unable to find some Variables in documentation

Post by tauseefAhmed »

Hello Clifton Crane,

Thank you for the information.
So ToggleDesignator and GetDesignator set the information related to Laser?
What infromation this send on DIS when triggered?
Laser Code, Target LLA etc?
How do we set the Laser Code? I can't find anything in the documentation.
Usually laser designators have a unique Code assigned to them. i.e. 1688.
The IDesignatorSrevice only receives the PDU's if I'm correct?
How about lasing a target, setting the laser code and send the information to DIS, so my wing-man on another computer may use the information to guide his weapon?
Clifton Crane
Lockheed Martin
Posts: 1207
Joined: Tue Sep 25, 2012 2:34 pm

Re: Unable to find some Variables in documentation

Post by Clifton Crane »

Hi tauseefAhmed,

See answers below. Its important to note that only the AvatarSim currently implements the IDesignatorService (see Army Infantry avatar SimObject). The "Night Vision Goggles" camera has a Scaleform overlay that should allow the designator to be toggled on and off. This camera view will also render the designator into the view.
So ToggleDesignator and GetDesignator set the information related to Laser?

ToggleDesignator will toggle the Avatar's designator on/off. GetDesignator returns the state of the Avatar's designator (on/off).
What infromation this send on DIS when triggered?
Laser Code, Target LLA etc?

The DIS packet will contain the designator code name, code, power, wavelength, and spot location (see Avatar's DesignatorSystem.xml). If an entity is designated, the DIS entity ID will also be broadcast. The spot location and designated entity are based on the Avatar's camera orientation.
How do we set the Laser Code? I can't find anything in the documentation.
Usually laser designators have a unique Code assigned to them. i.e. 1688.

The laser code, as well as other properties, can be configured in the Avatar's DesignatorSystem.xml file.
The IDesignatorSrevice only receives the PDU's if I'm correct?

The IDesignatorService is used to provide DIS with the necessary information to broadcast Designator PDU's. In this case, the service is implemented by the Avatar, however this service can also be implemented by ISimObjects.
How about lasing a target, setting the laser code and send the information to DIS, so my wing-man on another computer may use the information to guide his weapon?

As stated above, the Avatar is the only object that currently supports the IDesignatorService. The designator information will be broadcast to other clients, however Prepar3D does not process incoming designator PDU's for targetting. Prepar3D does have the ability to render designators that they receive over DIS.

Hope this helps!

Regards,
Clifton
Clifton Crane
Prepar3D® Software Engineer Sr.
tauseefAhmed
Posts: 38
Joined: Wed Jul 31, 2019 4:56 pm

Re: Unable to find some Variables in documentation

Post by tauseefAhmed »

Hi CLifton,
Thank you. I have found the camera and XML file.

But I don't info related to the Object in here.

Code: Select all

<SimBase.Document Type="AceXML" version="1,0">
    <Descr>Designator System</Descr>
    <Filename>DesignatorSystem.XML</Filename>
    <Designators.DesignatorSystem>
        <UpdateThreshold>0.1</UpdateThreshold>
        <ObjectRayLengthMax>4000.0</ObjectRayLengthMax>
        <ObjectMinimumGranularity>4.0</ObjectMinimumGranularity>
        <TerrainRayLengthMax>20000.0</TerrainRayLengthMax>
        <TerrainMinimumGranularity>100.0</TerrainMinimumGranularity>
        <Designator>
            <DesignatorCodeName>0</DesignatorCodeName>
            <DesignatorCode>0</DesignatorCode>
            <DesignatorPower>200.0</DesignatorPower>
            <DesignatorWavelength>1.5</DesignatorWavelength>
        </Designator>
    </Designators.DesignatorSystem>
</SimBase.Document>
So what I understand is, these are the properties of laser and are pretty much constant if not changed manually.
It would be better if the SimmUser would have the control to change the properties, or at least the laser code at runtime.

Now, ToggleDesignator will turn on an object's designation property and since P3D knows the LLA and Object ID of that object, I can find the designated object in Camera from a distant vehicle. Perfect.

One thing though, If I were to render the laser beam on my own. Does P3D provide a service for that? For example, an object at Location L1 fires a laser at an object at L2. I want to draw a line between these two points. RayCast maybe.
Clifton Crane
Lockheed Martin
Posts: 1207
Joined: Tue Sep 25, 2012 2:34 pm

Re: Unable to find some Variables in documentation

Post by Clifton Crane »

Hi Tauseef,

The IObjectRendererV500 service allows plugins to draw primitive shapes. The Prepar3D SDK has the CustomPDKObjects sample that shows how it can be used.

Regards,
Clifton
Clifton Crane
Prepar3D® Software Engineer Sr.
tauseefAhmed
Posts: 38
Joined: Wed Jul 31, 2019 4:56 pm

Re: Unable to find some Variables in documentation

Post by tauseefAhmed »

Hi Clifton,
Thank you very much for your time. I've been going up and down in the learning center and found some things regarding laser. Please allow me to ask a few more questions.
There's an article related to Laser in Weapon configuration section. This took me right into simObjects->Weapons and I found Laser there. Upon opening the folder I found sim.cfg and model.cfg (which is empty, plus there's no model found).
What is this Laser object for?
Documentation says we can use it as a load-out on any attachment point.
Can you throw some light on this one?
Also, how about laser guidance. i.e. Fire a weapon, Designate target using laser and the weapon homes on to the designated target. If laser target has changed, weapon should also change it's course to the new target.
Do I have to write my own mechanism to guide weapon based on laser designation? Or does P3D has provided it already.


Thank you.
Regards,
Tauseef
Clifton Crane
Lockheed Martin
Posts: 1207
Joined: Tue Sep 25, 2012 2:34 pm

Re: Unable to find some Variables in documentation

Post by Clifton Crane »

Hi Tauseef,

The "Laser" SimObject can be attached to an object in the same way as a Weapon SimObject using the Attachments.xml. As an example, the "LCS-1 USS Freedom" Boat SimObject has a loadout with a laser attached.

The laser can be activated using the weapons system's fire key events. When the laser is activated it will apply damage to the current target. The target can be set using the SimObject's fire control system, similar to other weapons.

The laser does not guide other weapons. To change a weapon's target mid-flight, a plugin can QuerySerivce the weapon's IBaseObject for the IGuidanceSystemV01 interface. This interface should allow the weapon's current target to be set by object ID or world position.

Regards,
Clifton
Clifton Crane
Prepar3D® Software Engineer Sr.
tauseefAhmed
Posts: 38
Joined: Wed Jul 31, 2019 4:56 pm

Re: Unable to find some Variables in documentation

Post by tauseefAhmed »

Hi Clifton,
Thank you for your time. Really appreciate your help.
I'll start looking into the techniques you mentioned. Hope this solves my issues.
Have a good day!


Regards,
Tauseef
tauseefAhmed
Posts: 38
Joined: Wed Jul 31, 2019 4:56 pm

Re: Unable to find some Variables in documentation

Post by tauseefAhmed »

Hello Clifton,
I have followed your instructions and now I am on the right track.
While I was going through CustomPDKObjects, I got another question.
It was not relevant to Laser designation so I have posted it separately.
Please take a look at this.
https://www.prepar3d.com/forum/viewtopi ... 1&t=138855

I posted question related to this topic a while ago but got no reply from LM team.
I hope you'll be able to help.

Regards,
Tauseef
tauseefAhmed
Posts: 38
Joined: Wed Jul 31, 2019 4:56 pm

Re: Unable to find some Variables in documentation

Post by tauseefAhmed »

So, I used CustomPDKObjects to draw a line to represent laser beam. But there's a tiny problem. P3D stops rendering the line correctly when I switch views.
I'm drawing the line between user Aircraft and the currently selected target, using targeting pod plugin.
When I'm in targeting pod view, the line tracks the target as the target moves. But when I change the view, line stops following the object. After I switch back to tagrteingPodView, it starts tracking the object again. I ran the scenario by opening targeting pod view and Locked Spot view side by side. The line was rendered as it should have.
Is it normal? Does the plugin stops updating target data if the view is switched or is there anything else I need to check in my code?

Regards,
Tauseef
Clifton Crane
Lockheed Martin
Posts: 1207
Joined: Tue Sep 25, 2012 2:34 pm

Re: Unable to find some Variables in documentation

Post by Clifton Crane »

Hi Tauseef,

Which callback are you using the render your line? The CustomPDKObjects sample uses the OnCustomRender callback provided by the PdkPlugin base class. This callback is called once per rendered view, allowing the plugin to render into all open views.

Thanks,
Clifton
Clifton Crane
Prepar3D® Software Engineer Sr.
tauseefAhmed
Posts: 38
Joined: Wed Jul 31, 2019 4:56 pm

Re: Unable to find some Variables in documentation

Post by tauseefAhmed »

Hi Clifton,
Update: I'm now using the CustomPDKObjects plugin to draw the line rather than it's implementation in TargetingPod Plugin. I'm passing Target LLA as the end point's LLA in DarwLine function.
There's a function OnCustomRender available in the plugin, yes. But the line stops tracking the moving object when I switch views. It renders on the last point which I switched the view at. Does it stop receiving target LLA after switching views? That's why it stops tracking the object? I'm assuming this because the moment I switch the view back to Targeting Pod, line keeps its tracking on the moving object.

And if I open targetingPod View and another view simulaniously (One in docked view and other in full screen), line renders as I should in both cameras.
Any thoughts?

Regards,
Tauseef
Clifton Crane
Lockheed Martin
Posts: 1207
Joined: Tue Sep 25, 2012 2:34 pm

Re: Unable to find some Variables in documentation

Post by Clifton Crane »

Hi Tauseef,

This appears to be the current behavior of the ControllableCamera. The ControllableCamera uses callbacks from the Window associated with the Camera to update the target location. These callbacks are only called when the ControllableCamera Window is open. There could be target information available in the object's Fire Control System, however this may only apply when the ControllableCamera is set to track an entity or a fixed world location. If the camera is not tracking a specific target, the FCS target location will not be updated as the camera's "look at" location is not available.

Regards,
Clifton
Clifton Crane
Prepar3D® Software Engineer Sr.
tauseefAhmed
Posts: 38
Joined: Wed Jul 31, 2019 4:56 pm

Re: Unable to find some Variables in documentation

Post by tauseefAhmed »

Hi Clifton,
I've got your point. Thanks for being there to help.

I have posted another question related to CustomPDKObjects. Please have a look at that one, if you could spare some minutes, please.
It is about the Menu Items created in CustomPDKObjects. I want to create them not in the Top Menu Bar but anywhere I click on screen. I hope you can help me with that.

Here's the link for the post.

https://www.prepar3d.com/forum/viewtopi ... 1&t=138855


Regards,
Tauseef
Post Reply